Bug 659582

Summary: gcc: internal compiler error: in get_insn_template, at final.c:1726
Product: Red Hat Enterprise Linux 6 Reporter: harry muttart <harry>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED ERRATA QA Contact: qe-baseos-tools-bugs
Severity: medium Docs Contact:
Priority: low    
Version: 6.0CC: law, mfranc, pmuller
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: gcc-4.4.5-5.el6 Doc Type: Bug Fix
Doc Text:
Previously, using "always_inline" on a function when compiling with "-g" without any "-O" options would cause the compiler to insert debugging annotations in unexpected locations. Consequently, the unexpected annotations caused the compiler to crash with an internal error. In these updated packages, the compiler is modified to properly handle attributes which change optimization levels, such as always_inline, properly.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-19 13:58:02 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Preprocessed source file for gcc failure...
none
Fix bad interaction between inlining, optimize attribute and var-tracking none

Description harry muttart 2010-12-03 03:24:09 UTC
Created attachment 464485 [details]
Preprocessed source file for gcc failure...

Description of problem:

gcc dies from internal error.

...: internal compiler error: in get_insn_template, at final.c:1726


Version-Release number of selected component (if applicable):

gcc (GCC) 4.4.4 20100726 (Red Hat 4.4.4-13)  on RH6
gcc (GCC) 4.4.3 20100127 (Red Hat 4.4.3-4)   on fc12


How reproducible:

  every time.

Steps to Reproduce:
1.see command line from the output file created by the failure...
2.
3.
  
Actual results:

src/azshare/vm/gc_implementation/genPauseless/gpgc_pageInfo.hpp:114: warning: inline function ‘static bool GPGC_PageInfo::is_live_tlab_object(oopDesc*)’ used but never defined
src/azshare/vm/gc_implementation/genPauseless/gpgc_pageInfo.hpp:183: warning: inline function ‘void GPGC_PageInfo::atomic_increment_flags_count(uint64_t)’ used but never defined
src/azshare/vm/gc_implementation/genPauseless/gpgc_pageInfo.hpp:179: warning: inline function ‘void GPGC_PageInfo::atomic_set_flag(GPGC_PageInfo::Flags, GPGC_PageInfo::Flags)’ used but never defined
src/share/vm/memory/gcLocker.hpp:86: warning: inline function ‘static bool GC_locker::is_active()’ used but never defined
src/azshare/vm/runtime/synchronizer.cpp: In static member function ‘static heapRef ObjectSynchronizer::lock(heapRef, MonitorInflateCallerId)’:
src/azshare/vm/runtime/synchronizer.cpp:241: internal compiler error: in get_insn_template, at final.c:1726
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
{standard input}: Assembler messages:
{standard input}:19007: Error: open CFI at the end of file; missing .cfi_endproc directive
Preprocessed source stored into /tmp/ccvoxnoQ.out file, please attach this to your bugreport.



Expected results:

Sucessful compile -- in the meantime, a workaround would be helpful.

Additional info:

Comment 2 Jeff Law 2010-12-06 13:15:32 UTC
This is a bad interaction between inlining, attribute optimized and the var tracking code.  I have a potential patch that I'll be running through the usual battery of tests.

Comment 3 Jakub Jelinek 2010-12-06 13:22:11 UTC
Workaround is of course not using optimize or target attributes, they have never been reliable and at least up to 4.6, inclusive, won't be reliable.

Comment 4 Jeff Law 2010-12-06 17:26:13 UTC
I probably won't get test results for the fix until late today or early tomorrow as one of my testboxes fried its drive and thus everything in the queue is going take a bit longer.

WRT a workaround, the failing file has a single function which uses the optimize attribute, so a simple workaround would be to pull that function out into its own file, remove the optimize attribute and compile the resulting file with -O0.

jeff

Comment 5 Jeff Law 2010-12-07 23:57:57 UTC
GCC 4.4 tests look good.  GCC 4.5 tests in progress.  

Reduced testcase (compile with -g):
void report_fatal_vararg(const char* file_name, int line_no, const char* format, ...) ;


typedef class oopDesc* oop;

class objectRef {
 public:
  long int _objref;

  inline bool is_heap() const __attribute__ ((always_inline)) {
    long int sid = (_objref);

    return (sid==2);

  }
  inline oop as_oop() const __attribute__ ((always_inline)) {
    if( !is_heap()) {
 	report_fatal_vararg("", 304, "" "0x%016lx", _objref );
	 __asm__ __volatile__("int $3");
 };
    return (oop)as_address();

  }
  char * as_address() volatile const { return (char *)(_objref);
 }
};

class ObjectSynchronizer{
public:
  static void lock(objectRef o) __attribute__ ((optimize("O0"))) ;

};

void ObjectSynchronizer::lock( objectRef ref) {
  oop obj=ref.as_oop();

}

Comment 6 Jeff Law 2010-12-08 14:33:18 UTC
Created attachment 467488 [details]
Fix bad interaction between inlining, optimize attribute and var-tracking

Jakub -- attached are backports of the two patches from the mainline and gcc-4.5 branches to fix this bug.  I'm not sure of the proper procedure for getting them into our gcc-4.4 branch and getting new rpms spun.

I can take care of those issues if you walk me through the process -- it's probably good if we have another engineer familiar with the process.

Jeff

Comment 8 Petr Muller 2011-01-10 14:54:21 UTC
qe_ack+, reproducers in attachment and in comment 5

Comment 10 Ryan Lerch 2011-04-20 04:32:26 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
a bug in attribute optimize handling has been fixed.

Comment 12 Jeff Law 2011-05-06 15:40:06 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1 +1,9 @@
-a bug in attribute optimize handling has been fixed.+a bug in attribute optimize handling has been fixed.
+
+Cause: Using the "always_inline" on a function when compiling with -g and without any -O options would cause the compiler to insert debugging annotations in unexpected locations.  The unexpected annotations would cause the compiler to crash with an internal error.
+
+Consequence: The compiler would crash.
+
+Fix: The compiler was modified to properly handle attributes which change optimization levels, such as always_inline, properly.
+
+Result: The compiler no longer crashes when presented with this situation.

Comment 13 Ryan Lerch 2011-05-16 03:04:31 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1,9 +1 @@
-a bug in attribute optimize handling has been fixed.
+Previously, using "always_inline" on a function when compiling with "-g" without any "-O" options would cause the compiler to insert debugging annotations in unexpected locations. Consequently, the unexpected annotations caused the compiler to crash with an internal error. In these updated packages, the compiler is modified to properly handle attributes which change optimization levels, such as always_inline, properly.-
-Cause: Using the "always_inline" on a function when compiling with -g and without any -O options would cause the compiler to insert debugging annotations in unexpected locations.  The unexpected annotations would cause the compiler to crash with an internal error.
-
-Consequence: The compiler would crash.
-
-Fix: The compiler was modified to properly handle attributes which change optimization levels, such as always_inline, properly.
-
-Result: The compiler no longer crashes when presented with this situation.

Comment 14 errata-xmlrpc 2011-05-19 13:58:02 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0663.html