[PR39461] ICE compiling qt4-x11 on powerpc

Bug #342335 reported by Colin Watson
2
Affects Status Importance Assigned to Milestone
gcc
Fix Released
Medium
gcc-4.3 (Ubuntu)
Fix Released
Medium
Unassigned
qt4-x11 (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: gcc-4.3

g++ ICEs when building qt4-x11 on powerpc. The complete build log is here:

  http://launchpadlibrarian.net/23399665/buildlog_ubuntu-jaunty-powerpc.qt4-x11_4.5.0-0ubuntu1_FAILEDTOBUILD.txt.gz

I've reduced the ICE to a reasonably minimal test case (although there were still two #includes that would have taken rather more effort to pare down), and preprocessed source is attached to this bug.

$ gcc -v
Using built-in specs.
Target: powerpc-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.3.3-5ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --disable-softfloat --enable-secureplt --enable-targets=powerpc-linux,powerpc64-linux --with-cpu=default32 --with-long-double-128 --enable-checking=release --build=powerpc-linux-gnu --host=powerpc-linux-gnu --target=powerpc-linux-gnu
Thread model: posix
gcc version 4.3.3 (Ubuntu 4.3.3-5ubuntu1)

Command line that triggers the ICE with minimal test case:

$ g++ -c -g -pthread -O2 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -fPIC -I. -I../../include -I../../include/QtCore -o .obj/release-shared/qstring.o -save-temps tools/qstring-minimal.cpp
tools/qstring-minimal.cpp: In function 'int qFindString(const QChar*, int, int, const QChar*, int, Qt::CaseSensitivity)':
tools/qstring-minimal.cpp:56: internal compiler error: in output_460, at config/rs6000/rs6000.md:11495
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.3/README.Bugs> for instructions.

Revision history for this message
In , Jakub-gcc (jakub-gcc) wrote :

/* { dg-options "-O2 -m32 -fvisibility=hidden -msecure-plt -fpic" } */

__attribute__((noinline)) int
foo (int x)
{
  return x;
}

int foo (int x);

int
bar (int x)
{
  return foo (x);
}

ICEs on the
  if (DEFAULT_ABI == ABI_V4 && flag_pic)
    {
      gcc_assert (!TARGET_SECURE_PLT);
      return \"b %z1@plt\";
    }
  else
    return \"b %z1\";
assertion in sibcall_value_nonlocal_sysv.

Revision history for this message
In , Jakub-gcc (jakub-gcc) wrote :

The problem is in the redundant prototype after function.
First the foo FUNCTION_DECL is created, afterwards finish_function calls c_determine_visibility on it which changes its visibility from default to hidden.
After this make_decl_rtl is called, determines the function binds locally and sets SYMBOL_FLAG_LOCAL|SYMBOL_FLAG_FUNCTION. Then merge_decls is called, which in turn clears visibility (sets it back to default) and calls make_decl_rtl to update the flags. At this point targetm.binds_local_p returns false, as it at that point has default visibility, so changes DECL_RTL's flags to SYMBOL_FLAG_FUNCTION alone. Then finish_decl calls c_determine_visibility again and sets it back to hidden visibility. But nothing afterwards calls make_decl_rtl again to update the symbol flags again.

To fix this, IMHO either c_determine_visibility and C++ determine_visibility
need to
if (((TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl))
     || TREE_CODE (decl) == FUNCTION_DECL)
    && DECL_RTL_SET_P (decl))
  make_decl_rtl (decl);
if it changed the visibility, or merge_decls/duplicate_decls would need to determine visibility. I'll try the former.

Revision history for this message
In , Jakub-gcc (jakub-gcc) wrote :

Created attachment 17292
gcc44-pr39175.patch

Patch I'm going to bootstrap/regtest.

Revision history for this message
In , Rguenth (rguenth) wrote :

This also ICEs on the 4.3 branch.

Revision history for this message
In , Jakub-gcc (jakub-gcc) wrote :

Subject: Bug 39175

Author: jakub
Date: Thu Feb 19 21:15:12 2009
New Revision: 144305

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=144305
Log:
 PR target/39175
 * c-common.c (c_determine_visibility): If visibility changed and
 DECL_RTL has been already set, call make_decl_rtl to update symbol
 flags.

 * decl2.c (determine_visibility): If visibility changed and
 DECL_RTL has been already set, call make_decl_rtl to update symbol
 flags.

 * gcc.dg/visibility-20.c: New test.
 * g++.dg/ext/visibility/visibility-11.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/ext/visibility/visibility-11.C
    trunk/gcc/testsuite/gcc.dg/visibility-20.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-common.c
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl2.c
    trunk/gcc/testsuite/ChangeLog

Revision history for this message
In , Jakub-gcc (jakub-gcc) wrote :

Fixed on the trunk so far.

Revision history for this message
Colin Watson (cjwatson) wrote :
Revision history for this message
Matthias Klose (doko) wrote :

- work around available lowering optimization to -O1
- fixed in GCC-4.4

Changed in gcc-4.3:
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Colin Watson (cjwatson) wrote :

Using -O1 instead of -O2 does not reproduce this bug, but using -O1 -foptimize-sibling-calls instead of -O2 does.

Revision history for this message
Kees Cook (kees) wrote : Re: [Bug 342335] Re: ICE compiling qt4-x11 on powerpc

On Fri, Mar 13, 2009 at 04:03:57PM -0000, Colin Watson wrote:
> Using -O1 instead of -O2 does not reproduce this bug, but using -O1
> -foptimize-sibling-calls instead of -O2 does.

Can we use -O2 -fno-optimize-sibling-calls? I'd prefer not to use -O1
(which would lose all the fortify protections) on this package.

--
Kees Cook
Ubuntu Security Team

Revision history for this message
Colin Watson (cjwatson) wrote : Re: ICE compiling qt4-x11 on powerpc

Yes, -O2 -fno-optimize-sibling-calls works here. I'm just trying to figure out how to glue that into qmake.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package qt4-x11 - 4.5.0-0ubuntu2

---------------
qt4-x11 (4.5.0-0ubuntu2) jaunty; urgency=low

  * kubuntu_09_powerpc_opts.patch: Build with
    -fno-optimize-sibling-calls on powerpc, until such time as we start
    using GCC 4.4 (LP: #342335).

 -- Colin Watson <email address hidden> Sat, 14 Mar 2009 13:33:52 +0000

Changed in qt4-x11:
status: New → Fix Released
Changed in gcc:
status: Unknown → New
Revision history for this message
In , Matthias Klose (doko) wrote :

*** Bug 39461 has been marked as a duplicate of this bug. ***

Changed in gcc:
status: New → Invalid
Kees Cook (kees)
Changed in gcc:
status: Invalid → Unknown
Changed in gcc:
status: Unknown → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gcc-4.3 - 4.3.3-5ubuntu4

---------------
gcc-4.3 (4.3.3-5ubuntu4) jaunty; urgency=low

  * Rebuild to fix dependencies on shared libs on lpia. LP: #343724.
  * Update to SVN 20090316 from the gcc-4_3-branch.
    - Fix PR fortran/39295, PR fortran/39292, PR c++/9634, PR c++/29469,
      PR c++/29607, PR target/39327.
    - Remove libjava-xulrunner-1.9, integrated upstream.
  * Fix PR target/39175, taken from the trunk. LP: #342335.
  * Update the spu cross compiler from the cell-gcc-4_3-branch 20090314.

 -- Matthias Klose <email address hidden> Mon, 16 Mar 2009 20:12:34 +0100

Changed in gcc-4.3:
status: Triaged → Fix Released
Revision history for this message
In , Bje-0 (bje-0) wrote :

Subject: Bug 39175

Author: bje
Date: Wed Mar 25 22:05:08 2009
New Revision: 145076

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=145076
Log:
 Backport from mainline:
 2009-02-19 Jakub Jelinek <email address hidden>

 PR target/39175
 * c-common.c (c_determine_visibility): If visibility changed and
 DECL_RTL has been already set, call make_decl_rtl to update symbol
 flags.

cp/
 * decl2.c (determine_visibility): If visibility changed and
 DECL_RTL has been already set, call make_decl_rtl to update symbol
 flags.

testsuite/
 * gcc.dg/visibility-20.c: New test.
 * g++.dg/ext/visibility/visibility-11.C: New test.

Added:
    branches/gcc-4_3-branch/gcc/testsuite/g++.dg/ext/visibility/visibility-11.C
    branches/gcc-4_3-branch/gcc/testsuite/gcc.dg/visibility-20.c
Modified:
    branches/gcc-4_3-branch/gcc/ChangeLog
    branches/gcc-4_3-branch/gcc/c-common.c
    branches/gcc-4_3-branch/gcc/cp/ChangeLog
    branches/gcc-4_3-branch/gcc/cp/decl2.c
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog

Revision history for this message
In , Bje-0 (bje-0) wrote :

Now fixed on the 4.3 branch and on mainline.

Changed in gcc:
status: In Progress → Fix Released
Changed in gcc:
importance: Unknown → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.