Bug 790221

Summary: g++ crashes compiling "asm goto" insite template function
Product: [Fedora] Fedora Reporter: Thiago Macieira <thiago>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 16CC: jakub, law
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-02-14 15:55:54 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Thiago Macieira 2012-02-13 23:23:24 UTC
Description of problem:
When trying to compile the following C++ source code, gcc crashes:

template<typename T> bool ref(T &x)
{ 
    asm goto("jz %l[no]" : : : : no); 
    return true; 
no: 
    return false; 
} 
int main(int argc, char **argv) { return ref(argc); }

Version-Release number of selected component (if applicable):
gcc-4.6.2-1.fc16.x86_64
gcc (GCC) 4.6.2 20111027 (Red Hat 4.6.2-1)

How reproducible:
Always

Steps to Reproduce:
1. Compile the above program
  
Actual results:
GCC crashes:
<stdin>: In function ‘bool ref(T&) [with T = int]’:
<stdin>:1:158: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.


Expected results:
The code is compiled.

Additional info:
GCC developers do not usually like bug reports on patched GCC versions, so I am reporting first to Fedora.

Comment 1 Jakub Jelinek 2012-02-14 15:55:54 UTC
Tracking this upstream - http://gcc.gnu.org/PR52247