Summary: | ICE on invalid dereferencing of void * | ||
---|---|---|---|
Product: | gcc | Reporter: | mikulas |
Component: | middle-end | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | minor | CC: | gcc-bugs, zsojka |
Priority: | P3 | Keywords: | ice-on-invalid-code |
Version: | 4.4.1 | ||
Target Milestone: | 4.7.0 | ||
Host: | i686-pc-linux-gnu | Target: | i686-pc-linux-gnu |
Build: | i686-pc-linux-gnu | Known to work: | 4.7.0 |
Known to fail: | Last reconfirmed: | 2009-11-09 10:16:57 |
Description
mikulas
2009-11-09 02:54:55 UTC
Which is because the gimplifier thinks this is an error for the frontend to pass through: Breakpoint 1, fancy_abort ( file=0x10b1ab8 "/space/rguenther/src/svn/trunk/gcc/gimplify.c", line=7173, function=0x10b2ca4 "gimplify_expr") at /space/rguenther/src/svn/trunk/gcc/diagnostic.c:728 728 internal_error ("in %s, at %s:%d", function, trim_filename (file), line); (gdb) up #1 0x00000000007fa0a5 in gimplify_expr (expr_p=0x7ffff6f07a48, pre_p=0x7fffffffced8, post_p=0x7fffffffc558, gimple_test_f=0x7b9486 <is_gimple_asm_val>, fallback=1) at /space/rguenther/src/svn/trunk/gcc/gimplify.c:7173 7173 gcc_assert (!VOID_TYPE_P (TREE_TYPE (*expr_p))); (gdb) #2 0x00000000007e9450 in gimplify_asm_expr (expr_p=0x7ffff7ede980, pre_p=0x7fffffffced8, post_p=0x7fffffffc558) at /space/rguenther/src/svn/trunk/gcc/gimplify.c:4896 4896 tret = gimplify_expr (&TREE_VALUE (link), pre_p, post_p, the C standard doesn't claim dereferencing a void pointer is invalid, so the gimplifier should deal with this. Before tree-ssa we ICEd with t5.c:3: internal compiler error: in int_mode_for_mode, at stor-layout.c:289 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. or with 2.95 with t5.c:3: Internal compiler error in `emit_move_insn_1', at expr.c:2835 so, not a regression. Subject: Re: ICE on invalid dereferencing of void *
On Mon, 9 Nov 2009, rguenth at gcc dot gnu dot org wrote:
> the C standard doesn't claim dereferencing a void pointer is invalid, so
> the gimplifier should deal with this.
It's not invalid in general, but if the value gets used (NB conditional
expressions involving such dereferences, whose values don't get used, are
OK; DR 106) then it is invalid and there should be an error; "void value
not ignored as it ought to be" is used in some places. Though I note that
if you change the dereference in the present testcase to use the return
value of a function returning void, the resulting error "using result of
function returning 'void'" comes from the gimplifier and not the front
end, so making the gimplifier deal with this case as well would at least
be consistent.
You can dereference void * in asm arguments --- i.e. void *p; ... asm volatile ("prefetch %0"::"m"(*p)); gcc warns in this case about the dereference and maybe it shouldn't (but it's trivial to supress the warning with a cast to char *). If you change "m" constraint to "mr", you get an ICE. Fixed long ago, most probly in r172298. Could someone close? Fixed. |