Open GoogleCodeExporter opened 9 years ago
Note that GCC sometimes optimizes variables in frontend regardless of
optimization level.
Original comment by tetra20...@gmail.com
on 22 May 2015 at 6:35
But why '-fsanitize=address' changes optimizations?
It's possible that it's something with gcc internals, but ever since I'm
working on pretty big C89 project compiled on gcc-s 2.95.3-5.1 I've *never*
encountered '<optimized out>' without '-O' switch, especially with a '-g' one…
That variable should not be optimized out since it's passed around and written
into. Any combination of '-O' and '-g' switches doesn't stop it from
„disappearing”, also making the variable volatile (!). Only disabling ASAN.
Original comment by athan...@athi.pl
on 22 May 2015 at 7:07
Ah, sorry, I thought you meant t. I've check compiler dumps with
-fdump-tree-all and it looks like d is preserved by ASan:
$ cat test.c.169t.optimized
...
;; Function main (main, funcdef_no=3, decl_uid=2584, symbol_order=3)
main ()
{
<bb 2>:
d = 4;
t = "";
fun_wr (&d);
Perhaps GCC has some problem when generating debuginfo? Could you file a bug in
GCC bugzilla?
Original comment by tetra20...@gmail.com
on 22 May 2015 at 7:49
Already did. Year ago :-(
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61071
I don't think it's a problem with debuginfo, since decreasing size of t by one
makes printing the d variable work again.
Original comment by athan...@athi.pl
on 22 May 2015 at 8:01
Does this work with fresh clang?
I afraid that this is gcc-specific and there is little we can do on asan side.
Original comment by konstant...@gmail.com
on 22 May 2015 at 5:44
> Does this work with fresh clang?
Yeah, clang produces debugable binary.
clang version 3.6.0 (tags/RELEASE_360/final)
> I afraid that this is gcc-specific and there is little we can do on asan
side.
I understand. Thanks for your time, though.
Original comment by athan...@athi.pl
on 25 May 2015 at 5:18
Adding Project:AddressSanitizer as part of GitHub migration.
Original comment by ramosian.glider@gmail.com
on 30 Jul 2015 at 9:06
Original issue reported on code.google.com by
athan...@athi.pl
on 22 May 2015 at 5:45Attachments: