User account creation filtered due to spam.
Created attachment 40408 [details] Sources gcc -c -o server.o server.c -I. -I../../include -D__WINESRC__ -D_NTSYSTEM_ -D_REENTRANT -fPIC -Wall \ -pipe -fno-strict-aliasing -Wdeclaration-after-statement -Wempty-body -Wignored-qualifiers \ -Wshift-overflow=2 -Wstrict-prototypes -Wtype-limits -Wunused-but-set-parameter -Wvla \ -Wwrite-strings -Wpointer-arith -Wlogical-op -fno-omit-frame-pointer -O2 -march=pentium-m -m32 -pipe -D__i386__ gcc --version gcc (GCC) 6.2.1 20160916 (Red Hat 6.2.1-2) gcc -c -o server.o server.c -I. -I../../include -D__WINESRC__ -D_NTSYSTEM_ -D_REENTRANT -fPIC -Wall \ > -pipe -fno-strict-aliasing -Wdeclaration-after-statement -Wempty-body -Wignored-qualifiers \ > -Wshift-overflow=2 -Wstrict-prototypes -Wtype-limits -Wunused-but-set-parameter -Wvla \ > -Wwrite-strings -Wpointer-arith -Wlogical-op -fno-omit-frame-pointer -O2 -march=pentium-m -m32 -pipe -D__i386__ -v -save-temps gcc: warning: -pipe ignored because -save-temps specified Using built-in specs. COLLECT_GCC=gcc Target: x86_64-redhat-linux Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,objc,obj-c++,fortran,ada,go,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --disable-libgcj --with-isl --enable-libmpx --enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux Thread model: posix gcc version 6.2.1 20160916 (Red Hat 6.2.1-2) (GCC) COLLECT_GCC_OPTIONS='-c' '-o' 'server.o' '-I' '.' '-I' '../../include' '-D' '__WINESRC__' '-D' '_NTSYSTEM_' '-D' '_REENTRANT' '-fPIC' '-Wall' '-pipe' '-fno-strict-aliasing' '-Wdeclaration-after-statement' '-Wempty-body' '-Wignored-qualifiers' '-Wshift-overflow=2' '-Wstrict-prototypes' '-Wtype-limits' '-Wunused-but-set-parameter' '-Wvla' '-Wwrite-strings' '-Wpointer-arith' '-Wlogical-op' '-fno-omit-frame-pointer' '-O2' '-march=pentium-m' '-m32' '-pipe' '-D' '__i386__' '-v' '-save-temps' /usr/libexec/gcc/x86_64-redhat-linux/6.2.1/cc1 -E -quiet -v -I . -I ../../include -imultilib 32 -D __WINESRC__ -D _NTSYSTEM_ -D _REENTRANT -D __i386__ server.c -march=pentium-m -m32 -Wall -Wdeclaration-after-statement -Wempty-body -Wignored-qualifiers -Wshift-overflow=2 -Wstrict-prototypes -Wtype-limits -Wunused-but-set-parameter -Wvla -Wwrite-strings -Wpointer-arith -Wlogical-op -fPIC -fno-strict-aliasing -fno-omit-frame-pointer -O2 -fpch-preprocess -o server.i ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/6.2.1/include-fixed" ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/6.2.1/../../../../x86_64-redhat-linux/include" #include "..." search starts here: #include <...> search starts here: . ../../include /usr/lib/gcc/x86_64-redhat-linux/6.2.1/include /usr/local/include /usr/include End of search list. COLLECT_GCC_OPTIONS='-c' '-o' 'server.o' '-I' '.' '-I' '../../include' '-D' '__WINESRC__' '-D' '_NTSYSTEM_' '-D' '_REENTRANT' '-fPIC' '-Wall' '-pipe' '-fno-strict-aliasing' '-Wdeclaration-after-statement' '-Wempty-body' '-Wignored-qualifiers' '-Wshift-overflow=2' '-Wstrict-prototypes' '-Wtype-limits' '-Wunused-but-set-parameter' '-Wvla' '-Wwrite-strings' '-Wpointer-arith' '-Wlogical-op' '-fno-omit-frame-pointer' '-O2' '-march=pentium-m' '-m32' '-pipe' '-D' '__i386__' '-v' '-save-temps' /usr/libexec/gcc/x86_64-redhat-linux/6.2.1/cc1 -fpreprocessed server.i -quiet -dumpbase server.c -march=pentium-m -m32 -auxbase-strip server.o -O2 -Wall -Wdeclaration-after-statement -Wempty-body -Wignored-qualifiers -Wshift-overflow=2 -Wstrict-prototypes -Wtype-limits -Wunused-but-set-parameter -Wvla -Wwrite-strings -Wpointer-arith -Wlogical-op -version -fPIC -fno-strict-aliasing -fno-omit-frame-pointer -o server.s GNU C11 (GCC) version 6.2.1 20160916 (Red Hat 6.2.1-2) (x86_64-redhat-linux) compiled by GNU C version 6.2.1 20160916 (Red Hat 6.2.1-2), GMP version 6.1.1, MPFR version 3.1.4, MPC version 1.0.2, isl version 0.14 or 0.13 warning: MPFR header version 3.1.4 differs from library version 3.1.5. GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 GNU C11 (GCC) version 6.2.1 20160916 (Red Hat 6.2.1-2) (x86_64-redhat-linux) compiled by GNU C version 6.2.1 20160916 (Red Hat 6.2.1-2), GMP version 6.1.1, MPFR version 3.1.4, MPC version 1.0.2, isl version 0.14 or 0.13 warning: MPFR header version 3.1.4 differs from library version 3.1.5. GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: cf9b61d8c1933eb6edbda3ca13701096 At this point the compiler hangs (infinite 100% CPU usage).
Update: various -march variants have no effect. -O3 : still hangs -Os : compiles
Confirmed, started with r221983. I'm reducing the test-case.
Spins in lra: 32.64% cc1 [.] lra_create_live_ranges_1 10.52% cc1 [.] lra_assign 7.57% cc1 [.] bitmap_set_bit Trunk works fine for me.
The mentioned revision is probably not probably the culprit. Reduced test-case: $ cat tc.i a, b, d, e; *c; static interlocked_cmpxchg64 (long long *p1) { __sync_val_compare_and_swap (p1, b, a); } get_cached_fd () { if (!c) return; e = interlocked_cmpxchg64 (&c[d]); } $ timeout 10 gcc -O3 -march=pentium-m -m32 -c -fPIC -Wall -fno-strict-aliasing -fno-omit-frame-pointer tc.i [triggers time-out] Can you see it also on trunk?
(In reply to Martin Liška from comment #4) > Can you see it also on trunk? Yes, but only with -O3.
Created attachment 40409 [details] head -n700000 tc.i.274r.reload So the problem is older than r221983.
Slightly cleaned up testcase: /* PR rtl-optimization/78911 */ /* { dg-do compile } */ /* { dg-options "-O3 -fPIC -fno-strict-aliasing -fno-omit-frame-pointer" } */ /* { dg-additional-options "-fPIC" { target fpic } } */ /* { dg-additional-options "-march=pentium-m" { target ia32 } } */ int a, b, d, e; long long *c; static int foo (long long *x) { return __sync_val_compare_and_swap (x, b, a); } void bar (void) { if (!c) return; e = foo (&c[d]); } Started hanging with r216281.
(In reply to Martin Liška from comment #6) > Created attachment 40409 [details] > head -n700000 tc.i.274r.reload > > So the problem is older than r221983. Why do you think so? Reverting r221983 one-liner, introduced in PR65710 as a performance fix for earlier patch, allows me to compile the testcase. (In reply to Jakub Jelinek from comment #7) > Started hanging with r216281. Referred commit allowed atomic_compare_and_swapdi_doubleword pattern to directly use %ebx, which was not allowed before pseudo PIC reg was introduced. Mentioned pattern pushes i686 register pressure to the limit, it is somehow problematic for RA to handle, but RA managed to do correct reg allocation up to r221983.
At least for me it hangs already in that r216281: timeout 20 /opt/notnfs/gcc-bisect/obj/gcc/cc1.216281 -quiet -O3 -march=pentium-m -m32 -fPIC -fno-strict-aliasing -fno-omit-frame-pointer pr78911.c; echo $? 124 -bash-4.3$ timeout 20 /opt/notnfs/gcc-bisect/obj/gcc/cc1.216280 -quiet -O3 -march=pentium-m -m32 -fPIC -fno-strict-aliasing -fno-omit-frame-pointer pr78911.c; echo $? 0 (the latter is instant, fraction of a second).
(In reply to Jakub Jelinek from comment #9) > At least for me it hangs already in that r216281: I don't have PR at hand, but pLease note that there were some problems with this pattern in the past, fixed in the RA in the meantime. With pseudo-PIC, there is enough registers available for RA, even with allocated frame-pointer.
Investigating (but not entirely sure yet I'm getting somewhere).
Testcase for likely the same bug, at least hang starts at r221983. -fPIC -O2 -m32 -march=i686 -fno-omit-frame-pointer rh1406093.i long long *a, *b, c; int d, e; int baz (void); static inline long long foo (long long *x) { return __sync_val_compare_and_swap (x, 0, 0); } void bar () { int f = baz (); c = foo (&a[f]); if (c) e = d; a = b; }
Author: bernds Date: Fri Mar 10 21:17:13 2017 New Revision: 246059 URL: https://gcc.gnu.org/viewcvs?rev=246059&root=gcc&view=rev Log: PR rtl-optimization/78911 * lra-assigns.c (must_not_spill_p): New function. (spill_for): Use it. PR rtl-optimization/78911 * gcc.target/i386/pr78911-1.c: New test. * gcc.target/i386/pr78911-2.c: New test. Added: trunk/gcc/testsuite/gcc.target/i386/pr78911-1.c trunk/gcc/testsuite/gcc.target/i386/pr78911-2.c Modified: trunk/gcc/ChangeLog trunk/gcc/lra-assigns.c trunk/gcc/testsuite/ChangeLog
Fixed on trunk.
Strangely, this bug is still reproducible with GCC 6.3.1 and Wine 2.10.