Bug 55630 - pixman fails to compile with gcc version < 4.7.0
Summary: pixman fails to compile with gcc version < 4.7.0
Status: VERIFIED FIXED
Alias: None
Product: pixman
Classification: Unclassified
Component: pixman (show other bugs)
Version: git master
Hardware: All Linux (All)
: medium blocker
Assignee: Søren Sandmann Pedersen
QA Contact: Søren Sandmann Pedersen
URL: http://gcc.gnu.org/bugzilla/show_bug....
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-04 15:30 UTC by U. Artie Eoff
Modified: 2012-10-26 15:01 UTC (History)
4 users (show)

See Also:
i915 platform:
i915 features:


Attachments
partially reduced testcase (44.26 KB, text/plain)
2012-10-04 21:16 UTC, Siarhei Siamashka
Details
0001-Workaround-for-FTBS-with-gcc-4.6-http-gcc.gnu.org-PR.patch (953 bytes, patch)
2012-10-18 23:42 UTC, Siarhei Siamashka
Details | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description U. Artie Eoff 2012-10-04 15:30:39 UTC
Description
----------------

Fails to compile on gcc version < 4.7.0, but compiles fine on gcc version >= 4.7.0:

libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -Wall -fno-strict-aliasing -fvisibility=hidden -MT pixman-trap.lo -MD -MP -MF .deps/pixman-trap.Tpo -c pixman-trap.c -fPIC -DPIC -o .libs/pixman-trap.o
pixman-combine-float.c: In function 'combine_exclusion_u_float':
pixman-combine-float.c:485:61: sorry, unimplemented: inlining failed in call to 'combine_exclusion_a': function not considered for inlining
pixman-combine-float.c:61:30: sorry, unimplemented: called from here
pixman-combine-float.c:485:210: sorry, unimplemented: inlining failed in call to 'combine_exclusion_c': function not considered for inlining
pixman-combine-float.c:62:30: sorry, unimplemented: called from here
pixman-combine-float.c:485:210: sorry, unimplemented: inlining failed in call to 'combine_exclusion_c': function not considered for inlining
pixman-combine-float.c:63:30: sorry, unimplemented: called from here
pixman-combine-float.c:485:210: sorry, unimplemented: inlining failed in call to 'combine_exclusion_c': function not considered for inlining
pixman-combine-float.c:64:30: sorry, unimplemented: called from here
pixman-combine-float.c:485:61: sorry, unimplemented: inlining failed in call to 'combine_exclusion_a': function not considered for inlining
pixman-combine-float.c:115:30: sorry, unimplemented: called from here
pixman-combine-float.c:485:210: sorry, unimplemented: inlining failed in call to 'combine_exclusion_c': function not considered for inlining
pixman-combine-float.c:116:30: sorry, unimplemented: called from here
pixman-combine-float.c:485:210: sorry, unimplemented: inlining failed in call to 'combine_exclusion_c': function not considered for inlining
pixman-combine-float.c:117:30: sorry, unimplemented: called from here
make[3]: *** [pixman-combine-float.lo] Error 1
make[3]: *** Waiting for unfinished jobs....
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -Wall -fno-strict-aliasing -fvisibility=hidden -MT pixman-region16.lo -MD -MP -MF .deps/pixman-region16.Tpo -c pixman-region16.c -o pixman-region16.o >/dev/null 2>&1
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -Wall -fno-strict-aliasing -fvisibility=hidden -MT pixman-region32.lo -MD -MP -MF .deps/pixman-region32.Tpo -c pixman-region32.c -o pixman-region32.o >/dev/null 2>&1
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -Wall -fno-strict-aliasing -fvisibility=hidden -MT pixman-trap.lo -MD -MP -MF .deps/pixman-trap.Tpo -c pixman-trap.c -o pixman-trap.o >/dev/null 2>&1
mv -f .deps/pixman-trap.Tpo .deps/pixman-trap.Plo
mv -f .deps/pixman-region16.Tpo .deps/pixman-region16.Plo
mv -f .deps/pixman-region32.Tpo .deps/pixman-region32.Plo
make[3]: Leaving directory `/wld/sandybridge-f16-32/build/pixman/pixman'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/wld/sandybridge-f16-32/build/pixman/pixman'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/wld/sandybridge-f16-32/build/pixman'
make: *** [all] Error 2

First bad commit is http://cgit.freedesktop.org/pixman/commit/?id=a5b459114e35c7a946362f1e5857e8a87a403ec3
Comment 1 Siarhei Siamashka 2012-10-04 21:16:31 UTC
Created attachment 68094 [details]
partially reduced testcase

Confirmed with gcc 4.6.3, gcc 4.5 and gcc 4.7 seem to be fine.

Tried to reduce the testcase using delta tool (http://gcc.gnu.org/wiki/A_guide_to_testcase_reduction), but reproducibility becomes pretty unstable at some point and even minor changes make the bug go away.

This looks like some buggy memory accesses in gcc 4.6.x:

$ valgrind gcc-4.6.3 -O1 -c 228.i

==28969== Memcheck, a memory error detector
==28969== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==28969== Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info
==28969== Command: gcc-4.6.3 -O1 -c 228.i
==28969== 
==28969== Conditional jump or move depends on uninitialised value(s)
==28969==    at 0x4EBA2BB: __GI___strcasecmp_l (strcmp.S:243)
==28969==    by 0x4E68F67: bsearch (bsearch.c:38)
==28969==    by 0x4E64E1F: _nl_expand_alias (localealias.c:160)
==28969==    by 0x4E62F27: _nl_find_domain (finddomain.c:120)
==28969==    by 0x4E62765: __dcigettext (dcigettext.c:628)
==28969==    by 0x4148E5: gcc_init_libintl (intl.c:63)
==28969==    by 0x4028AF: main (gcc.c:6146)
==28969== 
==28969== Use of uninitialised value of size 8
==28969==    at 0x4EBC3F4: __GI___strcasecmp_l (strcmp.S:2257)
==28969==    by 0x4E68F67: bsearch (bsearch.c:38)
==28969==    by 0x4E64E1F: _nl_expand_alias (localealias.c:160)
==28969==    by 0x4E62F27: _nl_find_domain (finddomain.c:120)
==28969==    by 0x4E62765: __dcigettext (dcigettext.c:628)
==28969==    by 0x4148E5: gcc_init_libintl (intl.c:63)
==28969==    by 0x4028AF: main (gcc.c:6146)
==28969== 
==28969== Use of uninitialised value of size 8
==28969==    at 0x4EBC3F8: __GI___strcasecmp_l (strcmp.S:2258)
==28969==    by 0x4E68F67: bsearch (bsearch.c:38)
==28969==    by 0x4E64E1F: _nl_expand_alias (localealias.c:160)
==28969==    by 0x4E62F27: _nl_find_domain (finddomain.c:120)
==28969==    by 0x4E62765: __dcigettext (dcigettext.c:628)
==28969==    by 0x4148E5: gcc_init_libintl (intl.c:63)
==28969==    by 0x4028AF: main (gcc.c:6146)

Before reporting the bug to gcc, it is still needed to also test vanilla gcc 4.6.3 and 4.6 svn branch. But right now I only have a slow Atom netbook which is not very suited for the experiments involving compiling gcc. Will be back home next week to continue with this stuff (unless somebody else takes over).
Comment 2 Siarhei Siamashka 2012-10-04 21:31:04 UTC
(In reply to comment #1)
> This looks like some buggy memory accesses in gcc 4.6.x:
> 
> $ valgrind gcc-4.6.3 -O1 -c 228.i

Hmm, or maybe not (valgrind complains for the other gcc versions too and it could be bogus).
Comment 3 Knut Petersen 2012-10-12 09:24:24 UTC
(In reply to comment #1)
> Created attachment 68094 [details]
> partially reduced testcase
> 
> Confirmed with gcc 4.6.3, gcc 4.5 and gcc 4.7 seem to be fine.
> 
> 

Failure confirmed on an opensuse 12.1 system with the distributions gcc 4.6.2

cu,
 Knut
Comment 4 Darxus 2012-10-14 18:26:45 UTC
Last good commit is:  7a9c2d586b2349b5e17966a96d7fe8c390abb75a
Comment 5 Siarhei Siamashka 2012-10-18 02:00:16 UTC
Reported a bug to GCC bugzilla: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54965
Comment 6 U. Artie Eoff 2012-10-18 16:56:04 UTC
So what's the actual plan here to get developers back to the point where they are able to compile pixman on distros that only provide 4.6.x.?

Do we wait for GCC to fix the bug in the 4.6.x tree and then hope the distros provide an update package (Fedora 16 and Ubuntu Precise come to mind)?

Perhaps we should conditionally work around the issue in pixman for the 4.6.x bug.
Comment 7 Siarhei Siamashka 2012-10-18 17:38:00 UTC
(In reply to comment #6)
> Perhaps we should conditionally work around the issue in pixman for the
> 4.6.x bug.

I would assume that's the plan.
Comment 8 Siarhei Siamashka 2012-10-18 23:42:39 UTC
Created attachment 68771 [details] [review]
0001-Workaround-for-FTBS-with-gcc-4.6-http-gcc.gnu.org-PR.patch

A possible workaround is attached. Unfortunately (and expectedly) it causes a bunch of functions not to be inlined and indirect calls generated. Running "objdump -d pixman/pixman-combine-float.o | grep call | grep '*'" for GCC 4.6.3 shows indirect call instructions:
    1328:	ff 54 24 30          	callq  *0x30(%rsp)
    134b:	41 ff d7             	callq  *%r15
    136d:	41 ff d7             	callq  *%r15
    138f:	41 ff d7             	callq  *%r15
    14a5:	ff 54 24 30          	callq  *0x30(%rsp)
    14c7:	41 ff d7             	callq  *%r15
    14e8:	41 ff d7             	callq  *%r15
    1509:	41 ff d7             	callq  *%r15

For clang-3.1, icc-13.0.0, gcc-4.5.4 and gcc 4.7.2 there are no indirect call instructions in this code.

Maybe GCC developers can suggest a better solution if we give them a bit of time to look into this issue.
Comment 9 Søren Sandmann Pedersen 2012-10-22 20:27:11 UTC
(In reply to comment #8)
> Created attachment 68771 [details] [review] [review]
> 0001-Workaround-for-FTBS-with-gcc-4.6-http-gcc.gnu.org-PR.patch
> 
> A possible workaround is attached. Unfortunately (and expectedly) it causes
> a bunch of functions not to be inlined and indirect calls generated. Running
> "objdump -d pixman/pixman-combine-float.o | grep call | grep '*'" for GCC
> 4.6.3 shows indirect call instructions:
>     1328:	ff 54 24 30          	callq  *0x30(%rsp)
>     134b:	41 ff d7             	callq  *%r15
>     136d:	41 ff d7             	callq  *%r15
>     138f:	41 ff d7             	callq  *%r15
>     14a5:	ff 54 24 30          	callq  *0x30(%rsp)
>     14c7:	41 ff d7             	callq  *%r15
>     14e8:	41 ff d7             	callq  *%r15
>     1509:	41 ff d7             	callq  *%r15
> 
> For clang-3.1, icc-13.0.0, gcc-4.5.4 and gcc 4.7.2 there are no indirect
> call instructions in this code.
> 
> Maybe GCC developers can suggest a better solution if we give them a bit of
> time to look into this issue.

FWIW, I think this workaround makes sense. The bug seems to be confined to the combination of floating point combiners, which are not used that much yet, and GCC 4.6, which while widespread is only one version of the compiler.

I'd prefer a little more information in the commit message though.
Comment 10 Siarhei Siamashka 2012-10-23 14:53:08 UTC
(In reply to comment #9)
> FWIW, I think this workaround makes sense. The bug seems to be confined to
> the combination of floating point combiners, which are not used that much
> yet, and GCC 4.6, which while widespread is only one version of the compiler.

Yes, I just wanted to watch over the progress in the gcc bugtracker a bit longer. Mostly to get a better understanding whether this issue has any chance to be fixed in gcc 4.6.4+

But indeed, the original reporter of this bug might want to have a workaround applied to pixman git sooner.
 
> I'd prefer a little more information in the commit message though.

Just replicating the comment "GCC 4.6 has problems with force_inline, so just use normal inline instead" in the commit message and also a link to fdo bug would probably work .
Comment 11 Knut Petersen 2012-10-23 16:07:27 UTC
(In reply to comment #10)
> (In reply to comment #9)
> > FWIW, I think this workaround makes sense. The bug seems to be confined to
> > the combination of floating point combiners, which are not used that much
> > yet, and GCC 4.6, which while widespread is only one version of the compiler.
> 
> Yes, I just wanted to watch over the progress in the gcc bugtracker a bit
> longer. Mostly to get a better understanding whether this issue has any
> chance to be fixed in gcc 4.6.4+
> 
> But indeed, the original reporter of this bug might want to have a
> workaround applied to pixman git sooner.
> 

Well, after more than two weeks it´s time to include the workaround to the git tree. It is correct, it does not harm anybody, and it can be easily adapted if
4.6.4 would handle force_inline correctly.

cu,
 Knut
Comment 12 Siarhei Siamashka 2012-10-24 22:03:04 UTC
OK, pushed the workaround patch to pixman git. Thanks for reporting the problem and for your patience while waiting for a solution. Sorry for handling it slower than necessary.

Feel free to reopen the bug if the problem persists.
Comment 13 Darxus 2012-10-24 23:06:35 UTC
Thanks.  Fixed in:

commit 9df645dfb04b5a790faabe1e9a84fc37287d91b0
Author: Siarhei Siamashka <siarhei.siamashka@gmail.com>
Date:   Fri Oct 19 01:59:16 2012 +0300

    Workaround for FTBFS with gcc 4.6 (http://gcc.gnu.org/PR54965)
    
    GCC 4.6 has problems with force_inline, so just use normal inline instead.
    Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=55630
Comment 14 U. Artie Eoff 2012-10-26 15:01:46 UTC
verified fixed


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.