This is GCC Bugzilla
This is GCC Bugzilla Version 2.20+
View Bug Activity | Format For Printing | Clone This Bug
When running the testsuite with mainline on i686-pc-linux-gnu with -fpic or - fPIC, I get the following additional failures: FAIL: gcc.dg/assign-warn-3.c (test for warnings, line 9) FAIL: gcc.dg/assign-warn-3.c (test for warnings, line 13) The expected warnings simply fail to appear with the extra flag. Warning output should not be affected by this.
I cannot reproduce this with a cross from a couple of days ago.
With today's mainline I get the following results which confirm Kaveh's observations: gcc -c -O assign-warn-3.c: no warning gcc -c -O2 assign-warn-3.c: no warning gcc -c -O3 assign-warn-3.c: warning gcc -c -O assign-warn-3.c -fpic: no warning gcc -c -O2 assign-warn-3.c -fpic: no warning gcc -c -O3 assign-warn-3.c -fpic: no warning !!! That no warning is emitted with -O and -O2 is expected since no inlining takes place. Just for curiosity I marked f0 and f1 in the test as inline and got the following results: gcc -c -O assign-warn-3.c: no warning !!! gcc -c -O2 assign-warn-3.c: warning gcc -c -O3 assign-warn-3.c: warning gcc -c -O assign-warn-3.c -fpic: warning gcc -c -O2 assign-warn-3.c -fpic: warning gcc -c -O3 assign-warn-3.c -fpic: warning Here I'd expect a warning in all six cases.
(In reply to comment #2) > With today's mainline I get the following results which confirm > Kaveh's observations: > > gcc -c -O assign-warn-3.c: no warning > gcc -c -O2 assign-warn-3.c: no warning > gcc -c -O3 assign-warn-3.c: warning > gcc -c -O assign-warn-3.c -fpic: no warning > gcc -c -O2 assign-warn-3.c -fpic: no warning > gcc -c -O3 assign-warn-3.c -fpic: no warning !!! To repsond to this one, with -fpic/PIC we don't inline functions which can be overridden by other TUs.
(In reply to comment #3) > To repsond to this one, with -fpic/PIC we don't inline functions which can be overridden by other TUs. More to the point, this testcase is only testing when inlining which means with -fPIC it does not inline at all.
Nathan Froyd checked in a patch for this.