public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/41992] New: ICE on invalid dereferencing of void *
@ 2009-11-09 2:55 mikulas at artax dot karlin dot mff dot cuni dot cz
2009-11-09 10:17 ` [Bug middle-end/41992] " rguenth at gcc dot gnu dot org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: mikulas at artax dot karlin dot mff dot cuni dot cz @ 2009-11-09 2:55 UTC (permalink / raw)
To: gcc-bugs
Hi
This piece of invalid code (the dereference shouldn't be there) triggers an
ICE. The crash happens on 4.3.2, 4.4.1 and 4.4.2. It happens with or without
optimizations.
static void MONITOR(void *ptr)
{
__asm__ volatile (" \n\
XORL %%ECX, %%ECX \n\
XORL %%EDX, %%EDX \n\
MONITOR \n\
"::"a"(*ptr):"cx","dx","cc","memory");
}
s.e: In function 'MONITOR':
s.e:7: warning: dereferencing 'void *' pointer
s.e:7: internal compiler error: in gimplify_expr, at gimplify.c:7074
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
--
Summary: ICE on invalid dereferencing of void *
Product: gcc
Version: 4.4.1
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: mikulas at artax dot karlin dot mff dot cuni dot cz
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41992
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug middle-end/41992] ICE on invalid dereferencing of void *
2009-11-09 2:55 [Bug middle-end/41992] New: ICE on invalid dereferencing of void * mikulas at artax dot karlin dot mff dot cuni dot cz
@ 2009-11-09 10:17 ` rguenth at gcc dot gnu dot org
2009-11-09 13:17 ` joseph at codesourcery dot com
2009-11-11 21:06 ` mikulas at artax dot karlin dot mff dot cuni dot cz
2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-11-09 10:17 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from rguenth at gcc dot gnu dot org 2009-11-09 10:16 -------
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.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Keywords| |ice-on-invalid-code
Last reconfirmed|0000-00-00 00:00:00 |2009-11-09 10:16:57
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41992
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug middle-end/41992] ICE on invalid dereferencing of void *
2009-11-09 2:55 [Bug middle-end/41992] New: ICE on invalid dereferencing of void * mikulas at artax dot karlin dot mff dot cuni dot cz
2009-11-09 10:17 ` [Bug middle-end/41992] " rguenth at gcc dot gnu dot org
@ 2009-11-09 13:17 ` joseph at codesourcery dot com
2009-11-11 21:06 ` mikulas at artax dot karlin dot mff dot cuni dot cz
2 siblings, 0 replies; 4+ messages in thread
From: joseph at codesourcery dot com @ 2009-11-09 13:17 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from joseph at codesourcery dot com 2009-11-09 13:16 -------
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.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41992
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug middle-end/41992] ICE on invalid dereferencing of void *
2009-11-09 2:55 [Bug middle-end/41992] New: ICE on invalid dereferencing of void * mikulas at artax dot karlin dot mff dot cuni dot cz
2009-11-09 10:17 ` [Bug middle-end/41992] " rguenth at gcc dot gnu dot org
2009-11-09 13:17 ` joseph at codesourcery dot com
@ 2009-11-11 21:06 ` mikulas at artax dot karlin dot mff dot cuni dot cz
2 siblings, 0 replies; 4+ messages in thread
From: mikulas at artax dot karlin dot mff dot cuni dot cz @ 2009-11-11 21:06 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from mikulas at artax dot karlin dot mff dot cuni dot cz 2009-11-11 21:06 -------
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.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41992
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-11-11 21:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-09 2:55 [Bug middle-end/41992] New: ICE on invalid dereferencing of void * mikulas at artax dot karlin dot mff dot cuni dot cz
2009-11-09 10:17 ` [Bug middle-end/41992] " rguenth at gcc dot gnu dot org
2009-11-09 13:17 ` joseph at codesourcery dot com
2009-11-11 21:06 ` mikulas at artax dot karlin dot mff dot cuni dot cz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).