[Bug lto/61048] compiling with -fsanitize=address crashes GCC if pointers are used

2019-05-13 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61048

Martin Liška  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 CC||marxin at gcc dot gnu.org
 Resolution|--- |DUPLICATE

--- Comment #8 from Martin Liška  ---
It's already fixed.

*** This bug has been marked as a duplicate of bug 69254 ***

[Bug lto/61048] compiling with -fsanitize=address crashes GCC if pointers are used

2019-05-11 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61048

Eric Gallager  changed:

   What|Removed |Added

 CC||dodji at gcc dot gnu.org,
   ||dvyukov at google dot com,
   ||jakub at gcc dot gnu.org,
   ||kcc at gcc dot gnu.org

--- Comment #7 from Eric Gallager  ---
cc-ing sanitizer maintainers

[Bug lto/61048] compiling with -fsanitize=address crashes GCC if pointers are used

2018-02-12 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61048

Eric Gallager  changed:

   What|Removed |Added

   Keywords||patch
 CC||egallager at gcc dot gnu.org

--- Comment #6 from Eric Gallager  ---
(In reply to Ilya Palachev from comment #5)
> Created attachment 33725 [details]
> Patch that fixes the ICE (2nd version)
> 
> The 2nd version of patch was posted at
> https://gcc.gnu.org/ml/gcc-patches/2014-10/msg01364.html

Does this still apply against current trunk?

[Bug lto/61048] compiling with -fsanitize=address crashes GCC if pointers are used

2014-10-15 Thread i.palachev at samsung dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61048

Ilya Palachev i.palachev at samsung dot com changed:

   What|Removed |Added

  Attachment #33714|0   |1
is obsolete||

--- Comment #5 from Ilya Palachev i.palachev at samsung dot com ---
Created attachment 33725
  -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=33725action=edit
Patch that fixes the ICE (2nd version)

The 2nd version of patch was posted at
https://gcc.gnu.org/ml/gcc-patches/2014-10/msg01364.html


[Bug lto/61048] compiling with -fsanitize=address crashes GCC if pointers are used

2014-10-14 Thread i.palachev at samsung dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61048

--- Comment #2 from Ilya Palachev i.palachev at samsung dot com ---
Suggested a patch that fixes this issue.
https://gcc.gnu.org/ml/gcc-patches/2014-10/msg01264.html


[Bug lto/61048] compiling with -fsanitize=address crashes GCC if pointers are used

2014-10-14 Thread i.palachev at samsung dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61048

--- Comment #3 from Ilya Palachev i.palachev at samsung dot com ---
Created attachment 33714
  -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=33714action=edit
Patch that fixes the ICE.


[Bug lto/61048] compiling with -fsanitize=address crashes GCC if pointers are used

2014-10-14 Thread i.palachev at samsung dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61048

--- Comment #4 from Ilya Palachev i.palachev at samsung dot com ---
 g++ test.o -o test -Wl,-flto 
 /tmp/ccEhycoY.ltrans0.ltrans.o:ccEhycoY.ltrans0.o:function
 __static_initialization_and_destruction_0(int, int): error: undefined
 reference to '__asan_before_dynamic_init'
 /tmp/ccEhycoY.ltrans0.ltrans.o:ccEhycoY.ltrans0.o:function
 __static_initialization_and_destruction_0(int, int): error: undefined
 reference to '__asan_after_dynamic_init'
 collect2: error: ld returned 1 exit status

Such error is usual when option -fsanitize=address is not specified at the 2nd
stage. For example, without option -flto gcc prints the following error:

g++ -c test.cpp -fsanitize=address -o test_nolto.o
g++ test_nolto.o -o test_nolto
test_nolto.o:test.cpp:function main: error: undefined reference to
'__asan_report_load4'
test_nolto.o:test.cpp:function __static_initialization_and_destruction_0(int,
int): error: undefined reference to '__asan_before_dynamic_init'
test_nolto.o:test.cpp:function __static_initialization_and_destruction_0(int,
int): error: undefined reference to '__asan_after_dynamic_init'
test_nolto.o:test.cpp:function _GLOBAL__sub_D_00099_0_main: error: undefined
reference to '__asan_unregister_globals'
test_nolto.o:test.cpp:function _GLOBAL__sub_I_00099_1_main: error: undefined
reference to '__asan_init_v4'
test_nolto.o:test.cpp:function _GLOBAL__sub_I_00099_1_main: error: undefined
reference to '__asan_register_globals'
collect2: error: ld returned 1 exit status

So it seems that above patch provides that gcc produces correct output.


[Bug lto/61048] compiling with -fsanitize=address crashes GCC if pointers are used

2014-10-13 Thread i.palachev at samsung dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61048

Ilya Palachev i.palachev at samsung dot com changed:

   What|Removed |Added

 CC||i.palachev at samsung dot com

--- Comment #1 from Ilya Palachev i.palachev at samsung dot com ---
The error happens for the following sequence of commands

g++ test.cpp -c -o test.o -fsanitize=address -flto
g++ test.o -o test -Wl,-flto

And does not happen for the following sequence of commands:

g++ test.cpp -c -o test.o -fsanitize=address -flto
g++ test.o -o test -Wl,-flto -fsanitize=address

The ICE happens because sanitizer builtins are not initialized (returned tree
is null).
I've tried to force their initialization as follows:

diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c
index bc53632..f5ca849 100644
--- a/gcc/lto/lto.c
+++ b/gcc/lto/lto.c
@@ -55,6 +55,7 @@ along with GCC; see the file COPYING3.  If not see
 #include ipa-inline.h
 #include params.h
 #include ipa-utils.h
+#include asan.h


 /* Number of parallel tasks to run, -1 if we want to use GNU Make jobserver. 
*/
@@ -1856,6 +1857,9 @@ lto_read_decls (struct lto_file_decl_data *decl_data,
const void *data,
   data_in = lto_data_in_create (decl_data, (const char *) data +
string_offset,
header-string_size, resolutions);

+  /* Initialize sanitizer builtins if necessary.  */
+  initialize_sanitizer_builtins();
+
   /* We do not uniquify the pre-loaded cache entries, those are middle-end
  internal types that should not be merged.  */



But after applying this patch the following error happens during the 2nd
command:

g++ test.o -o test -Wl,-flto 
/tmp/ccEhycoY.ltrans0.ltrans.o:ccEhycoY.ltrans0.o:function
__static_initialization_and_destruction_0(int, int): error: undefined reference
to '__asan_before_dynamic_init'
/tmp/ccEhycoY.ltrans0.ltrans.o:ccEhycoY.ltrans0.o:function
__static_initialization_and_destruction_0(int, int): error: undefined reference
to '__asan_after_dynamic_init'
collect2: error: ld returned 1 exit status