This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/84433] gcc 7 and before miscompile loop and remove exit due to incorrect range calculation
- From: "marxin at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 19 Feb 2018 14:24:34 +0000
- Subject: [Bug middle-end/84433] gcc 7 and before miscompile loop and remove exit due to incorrect range calculation
- Auto-submitted: auto-generated
- References: <bug-84433-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84433
--- Comment #9 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to acsawdey from comment #7)
> Created attachment 43462 [details]
> revised test case
$ gcc pr84433-v2.c -fsanitize=undefined && ./a.out
pr84433-v2.c:36:11: runtime error: index 15 out of bounds for type 'structA
[15]'
B.int1 = 16 expected 16
Patching the file with:
diff -u pr84433-v2-original.c pr84433-v2.c
--- pr84433-v2-original.c 2018-02-19 15:22:40.250620365 +0100
+++ pr84433-v2.c 2018-02-19 15:22:45.054713707 +0100
@@ -9,7 +9,7 @@
typedef struct structC
{
struct structB sB[16][10];
- struct structA sA[15];
+ struct structA sA[16];
struct structA sA2[16];
uint32_t int1;
uint32_t int2;
$ gcc pr84433-v2.c -O2 && ./a.out
B.int1 = 16 expected 16