1806545 – Precompiled Header Don't Work At All With Gcc-8.3.1 (C++)

  • Login
Red Hat Bugzilla – Bug 1806545
  • Home
  • New
  • Search
  • My Links
  • Help
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at [email protected] to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated. Bug 1806545 - Precompiled header don't work at all with gcc-8.3.1 (C++) Summary: Precompiled header don't work at all with gcc-8.3.1 (C++)
Keywords: Triaged
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: gcc
Sub Component: --- system-version
Version: 8.3
Hardware: x86_64
OS: Unspecified
Priority: unspecified
Severity: unspecified
Target Milestone: rc
Target Release: 8.0
Assignee: Marek Polacek
QA Contact: qe-baseos-tools-bugs
Docs Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
Reported: 2020-02-24 13:55 UTC by Christian Hägele
Modified: 2023-07-18 14:19 UTC (History)
CC List: 8 users (show) ahajkova fweimer haegele jakub law mjtrangoni ohudlick sipoyare
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-03-13 15:55:53 UTC
Type: Bug
Target Upstream Version:
Embargoed:
Dependent Products: Container Native Virtualization (CNV) Ember-CSI ExternalDNS Operator for OpenShift Container Platform Kubernetes-native Infrastructure OpenShift Container Platform Red Hat Ceph Storage Red Hat Certificate System Red Hat CloudForms Management Engine Red Hat Directory Server Red Hat Enterprise MRG Red Hat Enterprise Virtualization Manager Red Hat Gluster Storage Red Hat OpenShift Data Foundation Red Hat OpenStack Service Telemetry Framework
Flags: pm-rhel: mirror+
Attachments (Terms of Use)
Description Christian Hägele 2020-02-24 13:55:08 UTC Description of problem: Precompiled-Headers don't work with the system-compiler. Same code compiles on all other platforms I tried. Even with the same Compiler-Version. Version-Release number of selected component (if applicable): gcc (GCC) 8.3.1 20190507 (Red Hat 8.3.1-4) How reproducible: Any C++-Program which tries to use precompiled-headers and uses -Winvalid-pch. I added a minimal example to reproduce. Steps to Reproduce: 1. echo "#include <iostream>" > test.txt 2. echo "#include "stdafx.h" int main() { std::cout << "Hello World" << std::endl; return 0; } " > test.txt 3. mkdir stdafx.h.gch 4. /usr/bin/c++ -Wall -Wextra -Werror -x c++-header -o stdafx.h.gch/.c++ stdafx.h 5. /usr/bin/c++ -Wall -Wextra -Werror -Winvalid-pch -o main.o -c main.cpp Actual results: main.cpp:1:20: error: stdafx.h.gch/.c++: had text segment at different address [-Werror] #include "stdafx.h" ^ Expected results: Compile succeeds without Warnings and Error and is using Precompiled-Headers Additional info: I tested the same code also with DevToolset-8 (GCC-8.3.1)on RHEL7 and also with GCC-8.2.1 on openSUSE Leap 15.1 and it works without problems. Comment 1 Christian Hägele 2020-02-24 14:03:52 UTC I did a stupid copy&paste mistake on the steps to reproduce. Sorry for that. Here are the correct steps: 1. echo "#include <iostream>" > stdafx.h 2. echo "#include "stdafx.h" int main() { std::cout << "Hello World" << std::endl; return 0; } " > main.cpp 3. mkdir stdafx.h.gch 4. /usr/bin/c++ -Wall -Wextra -Werror -x c++-header -o stdafx.h.gch/.c++ stdafx.h 5. /usr/bin/c++ -Wall -Wextra -Werror -Winvalid-pch -o main.o -c main.cpp Comment 2 Marek Polacek 2020-02-24 14:58:25 UTC Looks very much like a duplicate of Bug 1721553. Comment 3 Mario Trangoni 2020-02-24 16:20:33 UTC JFTR, the same code compiles on GCC-9 from GCC Toolset. $ sudo dnf install gcc-toolset-9-gcc-c++ $ scl enable gcc-toolset-9 bash $ c++ -Wall -Wextra -Werror -x c++-header -o stdafx.h.gch/.c++ stdafx.h $ c++ -Wall -Wextra -Werror -Winvalid-pch -o main.o -c main.cpp $ c++ --version c++ (GCC) 9.1.1 20190605 (Red Hat 9.1.1-2) Copyright (C) 2019 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Comment 4 Marek Polacek 2020-02-24 16:24:54 UTC Yes, that would make sense because I think we don't turn on hardening the compiler and its binaries in DTS 9. Comment 5 Christian Hägele 2020-03-03 13:22:09 UTC Is there any update on this issue? Did I do something wrong or is the current behavior expected? Comment 6 Jeff Law 2020-03-13 15:55:53 UTC This is expected behavior. GCC's PCH mechanism is fundamentally incompatible with the security hardening requirements for RHEL (PIE in particular). We are currently evaluating the best way to present a more friendly diagnostic for this issue.
Note You need to log in before you can comment on or make changes to this bug.

Từ khóa » Pch.h.gch