Bug 70150 - Additonal test failures with --enable-default-pie
Summary: Additonal test failures with --enable-default-pie
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: testsuite (show other bugs)
Version: 6.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
: 66400 66402 (view as bug list)
Depends on: 70192 70258
Blocks:
  Show dependency treegraph
 
Reported: 2016-03-09 01:31 UTC by psturm
Modified: 2019-09-24 04:10 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2016-03-10 00:00:00


Attachments
gcc6 --enable-default-pie causes hundreds of errors in test suite (3.53 KB, text/plain)
2016-03-09 01:31 UTC, psturm
Details
test suite summary (831 bytes, text/plain)
2016-03-17 22:33 UTC, psturm
Details

Note You need to log in before you can comment on or make changes to this bug.
Description psturm 2016-03-09 01:31:07 UTC
Created attachment 37902 [details]
gcc6 --enable-default-pie causes hundreds of errors in test suite

When building GCC6 weekly snapshot 20160306 and adding the --enable-default-pie to the configure script, hundreds of errors occur when running the test suite.

Platform is X86_64 on Intel Xeon D1540 "Broadwell"

Using glibc-2.23 with configure options:
    --prefix=/usr          \
    --disable-profile      \
    --enable-kernel=2.6.32 \
    --enable-obsolete-rpc \
    --enable-lock-elision=yes \
    --enable-stackguard-randomization \
    --enable-bind-now

Using binutils-2_26-branch with configure options:
                           --prefix=/usr   \
                           --enable-shared \
                           --disable-werror \
                           --disable-gdb \
                           --with-system-zlib

Using gcc-6-20160306 with configure options:
--prefix=/usr \
--enable-languages=c,c++ \
--disable-multilib \
--disable-bootstrap \
--with-system-zlib \
--disable-libmpx \
--disable-libstdcxx-pch \
--enable-default-pie \
--enable-checking=release

Attached is the test suite summary for gcc built with --enable-default-pie. The build without --enable-default-pie but all other configuration options being the same yielded only the 3 errors in PR ld/12365 of binutils 2.26 and these are false positives. There were also 2 libstdc++ errors that are marked "experimental" that occurred in both tests, so I am ignoring them.
Comment 1 H.J. Lu 2016-03-10 23:22:09 UTC
When GCC is configured with --enable-default-pie, -fno-pic doesn't
turn off PIC:

[hjl@gnu-6 gcc]$ ./xgcc -B./ -S x.c -fno-pic
x.c:2:3: error: #error foo
 # error foo
   ^~~~~
[hjl@gnu-6 gcc]$
Comment 2 H.J. Lu 2016-03-10 23:41:54 UTC
(In reply to H.J. Lu from comment #1)
> When GCC is configured with --enable-default-pie, -fno-pic doesn't
> turn off PIC:
> 
> [hjl@gnu-6 gcc]$ ./xgcc -B./ -S x.c -fno-pic
> x.c:2:3: error: #error foo
>  # error foo
>    ^~~~~
> [hjl@gnu-6 gcc]$

It isn't a bug since PIC is off by default, but PIE is on by default,
which also defines __PIC__, with --enable-default-pie.
Comment 3 Jakub Jelinek 2016-03-10 23:54:19 UTC
But -fno-pic should turn off even the default -fpie or -fPIE (if you force it through configure option) and also make sure neither __PIC__ nor __PIE__ macros are defined.
Comment 4 H.J. Lu 2016-03-11 00:04:05 UTC
(In reply to Jakub Jelinek from comment #3)
> But -fno-pic should turn off even the default -fpie or -fPIE (if you force
> it through configure option) and also make sure neither __PIC__ nor __PIE__
> macros are defined.

There is a separate issue and should be tracked with a new bug report.
Comment 5 H.J. Lu 2016-03-17 13:50:59 UTC
*** Bug 66400 has been marked as a duplicate of this bug. ***
Comment 6 H.J. Lu 2016-03-17 15:23:00 UTC
They should be fixed on hjl/pr70150 branch in GCC git repo.
Comment 7 psturm 2016-03-17 22:33:11 UTC
Created attachment 38007 [details]
test suite summary

I built hjl/pr70150 branch and while the prior test suite failures are gone, 6 new ones appeared. Full test suite summary is attached.

Running target unix
FAIL: g++.dg/ext/label13a.C  -std=gnu++98 execution test
FAIL: g++.dg/ext/label13a.C  -std=gnu++98  scan-assembler _ZN1CC4Ev
FAIL: g++.dg/ext/label13a.C  -std=gnu++11 execution test
FAIL: g++.dg/ext/label13a.C  -std=gnu++11  scan-assembler _ZN1CC4Ev
FAIL: g++.dg/ext/label13a.C  -std=gnu++14 execution test
FAIL: g++.dg/ext/label13a.C  -std=gnu++14  scan-assembler _ZN1CC4Ev
XPASS: g++.dg/tls/thread_local-order2.C  -std=c++11 execution test
XPASS: g++.dg/tls/thread_local-order2.C  -std=c++14 execution test

                === g++ Summary ===

# of expected passes            103282
# of unexpected failures        6
# of unexpected successes       2
# of expected failures          285
# of unsupported tests          3674
/sources/gcc-build/gcc/testsuite/g++/../../xg++  version 6.0.0 20160317 (experim
ental) (GCC)
Comment 8 H.J. Lu 2016-03-17 23:05:35 UTC
(In reply to psturm from comment #7)
> Created attachment 38007 [details]
> test suite summary
> 
> I built hjl/pr70150 branch and while the prior test suite failures are gone,
> 6 new ones appeared. Full test suite summary is attached.
> 
> Running target unix
> FAIL: g++.dg/ext/label13a.C  -std=gnu++98 execution test
> FAIL: g++.dg/ext/label13a.C  -std=gnu++98  scan-assembler _ZN1CC4Ev
> FAIL: g++.dg/ext/label13a.C  -std=gnu++11 execution test
> FAIL: g++.dg/ext/label13a.C  -std=gnu++11  scan-assembler _ZN1CC4Ev
> FAIL: g++.dg/ext/label13a.C  -std=gnu++14 execution test
> FAIL: g++.dg/ext/label13a.C  -std=gnu++14  scan-assembler _ZN1CC4Ev

Do you get them without --enable-default-pie?
Comment 9 psturm 2016-03-17 23:08:13 UTC
I didn't finish the full system build with --enable default-pie yet. I'll build it without next and let you know.
Comment 10 psturm 2016-03-18 01:24:28 UTC
Yes, exact same errors when built without --enable-default-pie.
Comment 11 H.J. Lu 2016-04-09 19:34:00 UTC
*** Bug 66402 has been marked as a duplicate of this bug. ***
Comment 13 psturm 2016-04-11 15:29:21 UTC
(In reply to H.J. Lu from comment #12)
> Patches are posted at
> 
> https://gcc.gnu.org/ml/gcc-patches/2016-03/msg00929.html
> https://gcc.gnu.org/ml/gcc-patches/2016-03/msg00995.html

https://gcc.gnu.org/ml/gcc-patches/2016-03/msg00929.html patch does not apply because it appears it conflicts with another change made for HPPA:

In weekly snapshot 6-20160410: gcc/testsuite/gcc.dg/uninit-19.c

/* { dg-warning "may be used uninitialized" "" { target { { nonpic } || { hppa*64*-*-* } } } 13 } */
/* { dg-warning "may be used uninitialized" "" { target { ! { { nonpic } || { hppa*64*-*-* } } } } 22 } */

patch is looking for:
-/* { dg-warning "may be used uninitialized" "" { target nonpic } 13 } */
-/* { dg-warning "may be used uninitialized" "" { target { ! nonpic } } 22 } */
Comment 14 H.J. Lu 2016-04-13 15:35:55 UTC
(In reply to psturm from comment #13)
> (In reply to H.J. Lu from comment #12)
> > Patches are posted at
> > 
> > https://gcc.gnu.org/ml/gcc-patches/2016-03/msg00929.html
> > https://gcc.gnu.org/ml/gcc-patches/2016-03/msg00995.html
> 
> https://gcc.gnu.org/ml/gcc-patches/2016-03/msg00929.html patch does not
> apply because it appears it conflicts with another change made for HPPA:

Please try patches on hjl/pr70150 branch.
Comment 15 psturm 2016-04-16 22:18:19 UTC
Tested with hjl/pr70150 branch and no unexpected errors using --enable-default-pie.

However, when testing the same branch with both --enable-default-pie and --enable-default-ssp, a couple new failures did show up (in addition to the 11 expected failures):

FAIL: gcc.target/i386/cleanup-1.c execution test
FAIL: gcc.target/i386/cleanup-2.c execution test

I am not sure whether this is relevant or not?
Comment 16 H.J. Lu 2016-04-17 17:53:17 UTC
(In reply to psturm from comment #15)
> Tested with hjl/pr70150 branch and no unexpected errors using
> --enable-default-pie.
> 
> However, when testing the same branch with both --enable-default-pie and
> --enable-default-ssp, a couple new failures did show up (in addition to the
> 11 expected failures):
> 
> FAIL: gcc.target/i386/cleanup-1.c execution test
> FAIL: gcc.target/i386/cleanup-2.c execution test
> 
> I am not sure whether this is relevant or not?

Do they fail with only --enable-default-ssp?
Comment 17 psturm 2016-04-17 23:55:16 UTC
Yes, they do appear when only using --enable-default-ssp, so I don't think they are relevant.
Comment 18 H.J. Lu 2016-04-18 00:02:45 UTC
(In reply to psturm from comment #17)
> Yes, they do appear when only using --enable-default-ssp, so I don't think
> they are relevant.

I suggest you open a new bug report if you haven't done so.
Comment 19 psturm 2016-04-18 00:16:38 UTC
H.J,

Done.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70230

On a separate topic, do you know an Intel colleague named Kirill Shutemov? I am having a problem with a kernel warning about a pmd_set_huge failure and an ACPI warning on my Xeon D-1540 development system when I load the ixgbe driver. The driver guys told me to post on linux-mm and I did, but no reply just yet. It seems Kirill Shumetov is active in the kernel memory management and this is an issue manifesting on an Intel system (both CPU and 10g ethernet). If not him, do you know anyone else I can contact about this?

Thanks,

Paul

----- Original Message -----
From: "hjl.tools at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: "psturm" <psturm@computervoice.com>
Sent: Sunday, April 17, 2016 6:02:45 PM
Subject: [Bug testsuite/70150] Additonal test failures with --enable-default-pie

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70150

--- Comment #18 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to psturm from comment #17)
> Yes, they do appear when only using --enable-default-ssp, so I don't think
> they are relevant.

I suggest you open a new bug report if you haven't done so.
Comment 20 Jakub Jelinek 2016-04-27 10:58:51 UTC
GCC 6.1 has been released.
Comment 21 Jakub Jelinek 2016-12-21 10:59:45 UTC
GCC 6.3 is being released, adjusting target milestone.
Comment 22 Richard Biener 2017-07-04 08:50:41 UTC
GCC 6.4 is being released, adjusting target milestone.
Comment 23 hjl@gcc.gnu.org 2018-09-25 12:26:16 UTC
Author: hjl
Date: Tue Sep 25 12:25:44 2018
New Revision: 264565

URL: https://gcc.gnu.org/viewcvs?rev=264565&root=gcc&view=rev
Log:
Check pie_enabled target in PIC tests

We need to check pie_enabled target in PIC tests to support GCC where
PIE is enabled by default when configured with --enable-default-pie.

	PR testsuite/70150
	* gcc.dg/20020312-2.c (dg-additional-options): Set to "-no-pie"
	for pie_enabled target.
	* gcc.dg/uninit-19.c: Check pie_enabled for PIC.
	* gcc.target/i386/pr34256.c: Likewise.

Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/20020312-2.c
    trunk/gcc/testsuite/gcc.dg/uninit-19.c
    trunk/gcc/testsuite/gcc.target/i386/pr34256.c
Comment 24 Martin Liška 2018-11-19 14:14:40 UTC
H.J. : Can you please update Known to work?