Bug 22448 - ICE on dereferencing a label in an asm statement
Summary: ICE on dereferencing a label in an asm statement
Status: RESOLVED DUPLICATE of bug 48552
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.0.1
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
: 23110 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-07-13 02:22 UTC by Matthew Dempsky
Modified: 2021-09-10 23:15 UTC (History)
2 users (show)

See Also:
Host: i386-pc-linux-gnu
Target:
Build:
Known to work:
Known to fail: 2.95, 3.2, 3.3.3, 3.4.0, 4.0.0, 4.1.0
Last reconfirmed: 2006-02-13 03:55:23


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Dempsky 2005-07-13 02:22:04 UTC
With gcc 4.0.1, compiling the following results in an ICE:

void
foo ()
{
label: asm ("" : : "g" (*&&label));
}

Admittedly I don't expect it to do anything useful, but I was told in #gcc that
I should report the ICE anyways.  (For what it's worth, this same code snippet
compiles without error in gcc 3.3 and 3.4.)
Comment 1 Andrew Pinski 2005-07-13 02:24:31 UTC
Confirmed, a regression from 3.4.0.
(In reply to comment #0)
> Admittedly I don't expect it to do anything useful, but I was told in #gcc that
> I should report the ICE anyways.

Yes by me :).
Comment 2 Andrew Pinski 2005-07-28 16:35:56 UTC
*** Bug 23110 has been marked as a duplicate of this bug. ***
Comment 3 Andrew Pinski 2005-07-28 16:38:41 UTC
Turns out this is not really a regression.  If you change g to r, it fails from 2.95.3 and up.
Comment 4 Gerry 2009-02-11 13:38:30 UTC
This also happens when dereferencing void pointers (this is invalid code though, but I get the same error with the code in the first post):

void foo (void *p)
{
	asm("" :: "g" (*p));
}

$ gcc -c foo.c
foo.c: In function ‘foo’:
foo.c:3: warning: dereferencing ‘void *’ pointer
foo.c:3: internal compiler error: in gimplify_expr, at gimplify.c:6288
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

$ gcc -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --prefix=/usr --enable-shared --enable-languages=c,c++,fortran,objc,obj-c++,treelang --enable-threads=posix --mandir=/usr/share/man --infodir=/usr/share/info --enable-__cxa_atexit --disable-multilib --libdir=/usr/lib --libexecdir=/usr/lib --enable-clocale=gnu --disable-libstdcxx-pch --with-tune=generic
Thread model: posix
gcc version 4.3.3 (GCC)
Comment 5 Andrew Pinski 2021-09-10 23:15:10 UTC
Fixed in GCC 4.7.0 and is a dup of bug 48552.

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