This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/78248] [7 Regression] wrong code at -Os and above on x86_64-linux-gnu (in both 32-bit and 64-bit modes)


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78248

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2016-11-09
     Ever confirmed|0                           |1

--- Comment #11 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Uroš Bizjak from comment #10)
> (In reply to Martin Liška from comment #8)
> 
> > I've already tried running the test-case in valgrind. But I can't see the
> > problem :) May you please paste -S file and --verbose output?
> 
> Done.
> 
> What I find iteresting at the segfault is the index e:
> 
> Program received signal SIGSEGV, Segmentation fault.
> main () at pr78248.c:16
> 16                  d = b[e];
> (gdb) p e
> $1 = 492
> 
> although we declare:
> 
> int b[1], c = 2, d, e, f, g;

I'm having the same binary, but it works. However this catches the problem:

gcc pr78248.c -Os --verbose-asm -fsanitize=undefined && ./a.out 
pr78248.c:17:18: runtime error: index 1 out of bounds for type 'int [1]'
pr78248.c:17:18: runtime error: load of address 0x0000006010f8 with
insufficient space for an object of type 'int'
0x0000006010f8: note: pointer points here
 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00
00 00 00  00 00 00 00
              ^ 
I'm going to investigate which revision introduced the problem.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]