[committed] analyzer: fix testsuite assumption that sizeof(int) > 2

Message ID 20200204155719.26741-1-dmalcolm@redhat.com
State New
Headers show
Series
  • [committed] analyzer: fix testsuite assumption that sizeof(int) > 2
Related show

Commit Message

David Malcolm Feb. 4, 2020, 3:57 p.m.
Fix some failures on xstormy16-elf:
  gcc.dg/analyzer/data-model-1.c  (test for warnings, line 595)
  gcc.dg/analyzer/data-model-1.c  (test for warnings, line 642)
  gcc.dg/analyzer/data-model-1.c  (test for warnings, line 690)
  gcc.dg/analyzer/data-model-1.c  (test for warnings, line 738)

due to:

warning: overflow in conversion from ‘long int’ to ‘int’ changes
  value from ‘100024’ to ‘-31048’ [-Woverflow]
    20 |   p[0].x = 100024;
       |            ^~~~~~


Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.

Manually verified on a stage1 --target=xstormy16-elf without asm
support; appears to now be correct there.

Pushed to master as c422cec54a5495f6f42b80f35a11c5508fe8eec3.

gcc/testsuite/ChangeLog:
	* gcc.dg/analyzer/data-model-1.c (struct coord): Convert fields
	from int to long.
---
 gcc/testsuite/gcc.dg/analyzer/data-model-1.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.21.0

Patch

diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-1.c b/gcc/testsuite/gcc.dg/analyzer/data-model-1.c
index 3f925941f87..d75b9fa1db3 100644
--- a/gcc/testsuite/gcc.dg/analyzer/data-model-1.c
+++ b/gcc/testsuite/gcc.dg/analyzer/data-model-1.c
@@ -171,8 +171,8 @@  int test_12c (void)
 
 struct coord
 {
-  int x;
-  int y;
+  long x;
+  long y;
 };
 
 int test_12d (struct coord c)