[Bug other/48981] New: bootstrap-lto -O3 produces miscompiled, broken gcc
d.g.gorbachev at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu May 12 16:29:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48981
Summary: bootstrap-lto -O3 produces miscompiled, broken gcc
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: other
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: d.g.gorbachev@gmail.com
CC: rguenth@gcc.gnu.org
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
GCC crashes because of violation of strict aliasing rules. The same memory
location is accessed in vec_gc_o_reserve_1 through (struct vec_prefix *)
pointer, then in VEC_tree_base_quick_push through (struct VEC_tree_base *).
Optimization moves the code around in a wrong way.
This patch fixes it:
--- gcc/vec.c
+++ gcc/vec.c
@@ -37,11 +37,11 @@
struct vec_prefix
{
unsigned num;
unsigned alloc;
void *vec[1];
-};
+} __attribute__ ((may_alias));
#ifdef GATHER_STATISTICS
/* Store information about each particular vector. */
More information about the Gcc-bugs
mailing list