This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/49721] convert_memory_address_addr_space may generate invalid new insns
- From: "hjl.tools at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 28 Jul 2011 21:11:16 +0000
- Subject: [Bug middle-end/49721] convert_memory_address_addr_space may generate invalid new insns
- Auto-submitted: auto-generated
- References: <bug-49721-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49721
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ubizjak at gmail dot com
--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> 2011-07-28 21:11:12 UTC ---
A testcase:
---
struct
{
int i;
double e;
int j;
} x;
void
f2 (void)
{
#pragma omp atomic
x.e /= 0.25;
}
---
compiled with -mx32 -O2 -fopenmp, I got
Breakpoint 1, convert_memory_address_addr_space (to_mode=SImode,
x=0x7ffff07ad720, as=0 '\000')
at /export/gnu/import/git/gcc/gcc/explow.c:399
399 return gen_rtx_fmt_ee (GET_CODE (x), to_mode,
(gdb) call debug_rtx (x)
(plus:DI (symbol_ref:DI ("x") <var_decl 0x7ffff0859140 x>)
(const_int 8 [0x8]))
(gdb) bt
#0 convert_memory_address_addr_space (to_mode=SImode, x=0x7ffff07ad720,
as=0 '\000') at /export/gnu/import/git/gcc/gcc/explow.c:399
#1 0x0000000000730a65 in convert_memory_address_addr_space (to_mode=SImode,
x=0x7ffff0931cc0, as=0 '\000')
at /export/gnu/import/git/gcc/gcc/explow.c:380
#2 0x0000000000763d4c in expand_expr_addr_expr (exp=0x7ffff0750b68,
target=0x0, tmode=SImode, modifier=EXPAND_SUM)
at /export/gnu/import/git/gcc/gcc/expr.c:7207
#3 0x0000000000773e81 in expand_expr_real_1 (exp=0x7ffff0750b68, target=0x0,
tmode=SImode, modifier=EXPAND_SUM, alt_rtl=0x0)
at /export/gnu/import/git/gcc/gcc/expr.c:9757
#4 0x0000000000764594 in expand_expr_real (exp=0x7ffff0750b68, target=0x0,
tmode=SImode, modifier=EXPAND_SUM, alt_rtl=0x0)
at /export/gnu/import/git/gcc/gcc/expr.c:7377
#5 0x00000000005c3c9e in expand_expr (exp=0x7ffff0750b68, target=0x0,
mode=SImode, modifier=EXPAND_SUM)
at /export/gnu/import/git/gcc/gcc/expr.h:419
#6 0x00000000005dd4a4 in get_builtin_sync_mem (loc=0x7ffff0750b68,
mode=DImode) at /export/gnu/import/git/gcc/gcc/builtins.c:5080
#7 0x00000000005de057 in expand_builtin_compare_and_swap (mode=DImode,
exp=0x7ffff07abbe0, is_bool=0 '\000', target=0x7ffff074ede0)
at /export/gnu/import/git/gcc/gcc/builtins.c:5186
#8 0x00000000005e3018 in expand_builtin (exp=0x7ffff07abbe0,
---Type <return> to continue, or q <return> to quit---q
target=0x7ffff074eQuit
(gdb)
This transformation is unsafe.