public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/54358] New: ICE in output_pic_addr_const
@ 2012-08-23 11:45 alexander.adam at informatik dot tu-chemnitz.de
  2012-08-23 11:46 ` [Bug c/54358] " alexander.adam at informatik dot tu-chemnitz.de
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: alexander.adam at informatik dot tu-chemnitz.de @ 2012-08-23 11:45 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54358

             Bug #: 54358
           Summary: ICE in output_pic_addr_const
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: alexander.adam@informatik.tu-chemnitz.de


Created attachment 28071
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28071
Output as mentioned in ICE output

In the attachment is a very stripped down version of the code that makes gcc
ICE. I tested with version:
     4.1.2.20070115 (prerelease) on SuSE Linux 32 bit
     4.7.1 on Debian (4.7.1-2) 64 bit with -m32-Flag

The command line used to compile the code was:
     gcc -O1 -fPIC -c -m32 -o test.o asm_p_flag_ice.c

This is a very minimalistic example.
It works fine if we use the function address as argument.
It works with other modifiers for the assembler.
It works if -fPIC is ommitted or -O0 is used.

I give here the options that were used to build the gcc bit on Debian:

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.1-2'
--with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs
--enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.7 --enable-shared --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object
--enable-plugin --enable-objc-gc --with-arch-32=i586 --with-tune=generic
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu
Thread model: posix
gcc version 4.7.1 (Debian 4.7.1-2)

$ uname -a
Linux dimensio0 3.2.0-3-amd64 #1 SMP Mon Jul 23 02:45:17 UTC 2012 x86_64
GNU/Linux

The output, if the file is compiled:

$ gcc -O1 -fPIC -c -m32 -o test.o asm_p_flag_ice.c 
asm_p_flag_ice.c: In function ‘ICE_func’:
asm_p_flag_ice.c:15:1: internal compiler error: in output_pic_addr_const, at
config/i386/i386.c:13099
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.7/README.Bugs> for instructions.
Preprocessed source stored into /tmp/ccLvrTP3.out file, please attach this to
your bugreport.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c/54358] ICE in output_pic_addr_const
  2012-08-23 11:45 [Bug c/54358] New: ICE in output_pic_addr_const alexander.adam at informatik dot tu-chemnitz.de
@ 2012-08-23 11:46 ` alexander.adam at informatik dot tu-chemnitz.de
  2012-08-23 11:48 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: alexander.adam at informatik dot tu-chemnitz.de @ 2012-08-23 11:46 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54358

--- Comment #1 from Alexander Adam <alexander.adam at informatik dot tu-chemnitz.de> 2012-08-23 11:46:18 UTC ---
Created attachment 28072
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28072
original source file with comments


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c/54358] ICE in output_pic_addr_const
  2012-08-23 11:45 [Bug c/54358] New: ICE in output_pic_addr_const alexander.adam at informatik dot tu-chemnitz.de
  2012-08-23 11:46 ` [Bug c/54358] " alexander.adam at informatik dot tu-chemnitz.de
@ 2012-08-23 11:48 ` rguenth at gcc dot gnu.org
  2012-08-23 11:54 ` [Bug target/54358] " rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-08-23 11:48 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54358

--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-08-23 11:47:46 UTC ---
*** Bug 54356 has been marked as a duplicate of this bug. ***


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/54358] ICE in output_pic_addr_const
  2012-08-23 11:45 [Bug c/54358] New: ICE in output_pic_addr_const alexander.adam at informatik dot tu-chemnitz.de
  2012-08-23 11:46 ` [Bug c/54358] " alexander.adam at informatik dot tu-chemnitz.de
  2012-08-23 11:48 ` rguenth at gcc dot gnu.org
@ 2012-08-23 11:54 ` rguenth at gcc dot gnu.org
  2012-08-23 13:30 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-08-23 11:54 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54358

--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-08-23 11:54:12 UTC ---
Btw, I think this is invalid asm:

int ICE_func ( void)
{
    void *returnaddr  = &&retaddr;    /* need the label address, works with
                     * function address
                     */

    __asm__("mov    %0,(%%esp)\n"
        : /* no outputs */
        : "p" (returnaddr)    /* ICE only with p. r and g are working
                     */
        : /* none modified */
     );
retaddr:
    return 0;
}

'p' is not a correct constraint for mov.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/54358] ICE in output_pic_addr_const
  2012-08-23 11:45 [Bug c/54358] New: ICE in output_pic_addr_const alexander.adam at informatik dot tu-chemnitz.de
                   ` (2 preceding siblings ...)
  2012-08-23 11:54 ` [Bug target/54358] " rguenth at gcc dot gnu.org
@ 2012-08-23 13:30 ` jakub at gcc dot gnu.org
  2012-08-23 13:49 ` alexander.adam at informatik dot tu-chemnitz.de
  2012-08-23 14:10 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-08-23 13:30 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54358

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |jakub at gcc dot gnu.org
         Resolution|                            |INVALID

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-08-23 13:29:49 UTC ---
Yes, definitely invalid.  With PIC p is not correct constraint for any code
label, address of a variable etc., all that requires adding some offset to the
PIC register, therefore must allow register in the constraint.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/54358] ICE in output_pic_addr_const
  2012-08-23 11:45 [Bug c/54358] New: ICE in output_pic_addr_const alexander.adam at informatik dot tu-chemnitz.de
                   ` (3 preceding siblings ...)
  2012-08-23 13:30 ` jakub at gcc dot gnu.org
@ 2012-08-23 13:49 ` alexander.adam at informatik dot tu-chemnitz.de
  2012-08-23 14:10 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: alexander.adam at informatik dot tu-chemnitz.de @ 2012-08-23 13:49 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54358

--- Comment #5 from Alexander Adam <alexander.adam at informatik dot tu-chemnitz.de> 2012-08-23 13:49:19 UTC ---
(In reply to comment #4)
> Yes, definitely invalid.  With PIC p is not correct constraint for any code
> label, address of a variable etc., all that requires adding some offset to the
> PIC register, therefore must allow register in the constraint.

But shouldn't the ICE be replaced by something like
    "do not use p constraint with -fPIC"
Instead of encouraging bug reports?


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/54358] ICE in output_pic_addr_const
  2012-08-23 11:45 [Bug c/54358] New: ICE in output_pic_addr_const alexander.adam at informatik dot tu-chemnitz.de
                   ` (4 preceding siblings ...)
  2012-08-23 13:49 ` alexander.adam at informatik dot tu-chemnitz.de
@ 2012-08-23 14:10 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-08-23 14:10 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54358

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-08-23 14:10:30 UTC ---
If inline-asm is not involved, sure.  But inline asm is a low level interface,
where it is user responsibility to supply correct constraints, we have some
quick measures, like a segfault handler if compiler segfaults during outputting
of an inline asm pattern, we emit an error instead of ICE, but that doesn't
handle assertion failures/aborts.  There are simply way too many things with
inline asm you can shoot yourself.  The gcc documentation says that p
constraint must be accompanied with address_operand check, which inline asm
can't provide, so the p constraint is probably never suitable for inline asm.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-08-23 14:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-23 11:45 [Bug c/54358] New: ICE in output_pic_addr_const alexander.adam at informatik dot tu-chemnitz.de
2012-08-23 11:46 ` [Bug c/54358] " alexander.adam at informatik dot tu-chemnitz.de
2012-08-23 11:48 ` rguenth at gcc dot gnu.org
2012-08-23 11:54 ` [Bug target/54358] " rguenth at gcc dot gnu.org
2012-08-23 13:30 ` jakub at gcc dot gnu.org
2012-08-23 13:49 ` alexander.adam at informatik dot tu-chemnitz.de
2012-08-23 14:10 ` jakub at gcc dot gnu.org

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).