public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/50943] New: asm goto in templated code causes internal compiler segfaults
@ 2011-11-01 12:02 dummyddd at gmail dot com
  2011-11-01 13:16 ` [Bug c++/50943] " rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: dummyddd at gmail dot com @ 2011-11-01 12:02 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 50943
           Summary: asm goto in templated code causes internal compiler
                    segfaults
    Classification: Unclassified
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: dummyddd@gmail.com


Created attachment 25675
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25675
The code that causes a segfault

I tested the code in mingw-tdm64 4.5.2, 4.6.1, and under the mac port for
4.6.1, all with the same result.

$ gcc-fsf-4.6 -v -save-temps main.cpp
Using built-in specs.
COLLECT_GCC=gcc-fsf-4.6
COLLECT_LTO_WRAPPER=/sw/lib/gcc4.6/libexec/gcc/x86_64-apple-darwin11.1.0/4.6.1/lto-wrapper
Target: x86_64-apple-darwin11.1.0
Configured with: ../gcc-4.6.1/configure --prefix=/sw
--prefix=/sw/lib/gcc4.6 --mandir=/sw/share/man
--infodir=/sw/lib/gcc4.6/info
--enable-languages=c,c++,fortran,lto,objc,obj-c++,java --with-gmp=/sw
--with-libiconv-prefix=/sw --with-ppl=/sw --with-cloog=/sw
--with-mpc=/sw --with-system-zlib --x-includes=/usr/X11R6/include
--x-libraries=/usr/X11R6/lib --program-suffix=-fsf-4.6
--enable-cloog-backend=isl
Thread model: posix
gcc version 4.6.1 (GCC)
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.7.2' '-v' '-save-temps'
'-mtune=core2'
 /sw/lib/gcc4.6/libexec/gcc/x86_64-apple-darwin11.1.0/4.6.1/cc1plus -E
-quiet -v -D__DYNAMIC__ main.cpp -fPIC -mmacosx-version-min=10.7.2
-mtune=core2 -fpch-preprocess -o main.ii
ignoring nonexistent directory
"/sw/lib/gcc4.6/lib/gcc/x86_64-apple-darwin11.1.0/4.6.1/../../../../x86_64-apple-darwin11.1.0/include"
#include "..." search starts here:
#include <...> search starts here:

/sw/lib/gcc4.6/lib/gcc/x86_64-apple-darwin11.1.0/4.6.1/../../../../include/c++/4.6.1

/sw/lib/gcc4.6/lib/gcc/x86_64-apple-darwin11.1.0/4.6.1/../../../../include/c++/4.6.1/x86_64-apple-darwin11.1.0

/sw/lib/gcc4.6/lib/gcc/x86_64-apple-darwin11.1.0/4.6.1/../../../../include/c++/4.6.1/backward
 /sw/lib/gcc4.6/lib/gcc/x86_64-apple-darwin11.1.0/4.6.1/include
 /usr/local/include
 /sw/lib/gcc4.6/include
 /sw/lib/gcc4.6/lib/gcc/x86_64-apple-darwin11.1.0/4.6.1/include-fixed
 /usr/include
 /System/Library/Frameworks
 /Library/Frameworks
End of search list.
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.7.2' '-v' '-save-temps'
'-mtune=core2'
 /sw/lib/gcc4.6/libexec/gcc/x86_64-apple-darwin11.1.0/4.6.1/cc1plus
-fpreprocessed main.ii -fPIC -quiet -dumpbase main.cpp
-mmacosx-version-min=10.7.2 -mtune=core2 -auxbase main -version -o main.s
GNU C++ (GCC) version 4.6.1 (x86_64-apple-darwin11.1.0)
       compiled by GNU C version 4.6.1, GMP version 5.0.2, MPFR version 3.0.1,
MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++ (GCC) version 4.6.1 (x86_64-apple-darwin11.1.0)
       compiled by GNU C version 4.6.1, GMP version 5.0.2, MPFR version 3.0.1,
MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: b15fbe702f97b74ba102fe17491ae6a1
main.cpp: In function ‘bool work(int*, int) [with T = int]’:
main.cpp:15:1: internal compiler error: Segmentation fault: 11
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
$ cat main.ii
# 1 "main.cpp"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "main.cpp"

template<class T>
bool work(int* data, int bit) {
    asm goto("lock and %0, %1;"
             "jz %l[other]"
    : : "r"(~(1 << bit)), "m"(data) : : other);
    return false;
other:
    return true;
}

int main(int argc, char** argv) {
    int data = 2;
    work<int>(&data, data);
    return 0;
}


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

* [Bug c++/50943] asm goto in templated code causes internal compiler segfaults
  2011-11-01 12:02 [Bug c++/50943] New: asm goto in templated code causes internal compiler segfaults dummyddd at gmail dot com
@ 2011-11-01 13:16 ` rguenth at gcc dot gnu.org
  2011-11-02 21:31 ` paolo.carlini at oracle dot com
  2011-11-07 23:48 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-11-01 13:16 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011-11-01
     Ever Confirmed|0                           |1
      Known to fail|                            |4.7.0

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-11-01 13:15:42 UTC ---
Confirmed.  The frontend fails to re-map the labels in the asm goto statement
leading to disagreement at gimplification time:

    stmt <cleanup_point_expr 0x14248dbb8 type <void_type 0x14233abd0 void>
        side-effects tree_1
        arg 0 <asm_expr 0x142324b40 type <void_type 0x14233abd0 void>
            side-effects public
..
            arg 4 <tree_list 0x14248dac8
                purpose <string_cst 0x142489f40 constant "other"> value
<label_decl 0x14248e080 other>>
...
    stmt <label_expr 0x14248dc08 type <void_type 0x14233abd0 void>
        side-effects
        arg 0 <label_decl 0x14248e200 other type <void_type 0x14233abd0 void>
            VOID file t.ii line 7 col 1
            align 1 context <function_decl 0x142481500 work> initial
<error_mark 0x142329d68>>
        t.ii:7:1>


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

* [Bug c++/50943] asm goto in templated code causes internal compiler segfaults
  2011-11-01 12:02 [Bug c++/50943] New: asm goto in templated code causes internal compiler segfaults dummyddd at gmail dot com
  2011-11-01 13:16 ` [Bug c++/50943] " rguenth at gcc dot gnu.org
@ 2011-11-02 21:31 ` paolo.carlini at oracle dot com
  2011-11-07 23:48 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-11-02 21:31 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|major                       |normal


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

* [Bug c++/50943] asm goto in templated code causes internal compiler segfaults
  2011-11-01 12:02 [Bug c++/50943] New: asm goto in templated code causes internal compiler segfaults dummyddd at gmail dot com
  2011-11-01 13:16 ` [Bug c++/50943] " rguenth at gcc dot gnu.org
  2011-11-02 21:31 ` paolo.carlini at oracle dot com
@ 2011-11-07 23:48 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-11-07 23:48 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |orestis at cs dot
                   |                            |columbia.edu

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-11-07 23:48:00 UTC ---
*** Bug 51016 has been marked as a duplicate of this bug. ***


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

end of thread, other threads:[~2011-11-07 23:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-01 12:02 [Bug c++/50943] New: asm goto in templated code causes internal compiler segfaults dummyddd at gmail dot com
2011-11-01 13:16 ` [Bug c++/50943] " rguenth at gcc dot gnu.org
2011-11-02 21:31 ` paolo.carlini at oracle dot com
2011-11-07 23:48 ` pinskia 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).