public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "scottbaldwin at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug pch/57242] New: gcc ignores precompiled headers unless the .gch and TU's are compiled with certain combinations of -g flag Date: Fri, 10 May 2013 16:50:00 -0000 [thread overview] Message-ID: <bug-57242-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57242 Bug ID: 57242 Summary: gcc ignores precompiled headers unless the .gch and TU's are compiled with certain combinations of -g flag Product: gcc Version: 4.8.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: pch Assignee: unassigned at gcc dot gnu.org Reporter: scottbaldwin at gmail dot com In GCC 4.7.2 and 4.8.x, precompiled headers (PCH) .gch file is ignored unless a certain combination of '-gN' debug options are used. To demonstrate, consider the following g++ commands to generate PCH (my_pch.hpp.gch) and compile a TU (foo.cpp) using the PCH cache: g++ $(PCH_DEBUG_FLAGS) -std=c++11 -m64 -Wall -Werror -Wno-unused -Wno-unused-variable -I./dbg-mt -I. -I. ./dbg-mt/my_pch.hpp -o ./dbg-mt/my_pch.hpp.gch g++ $(CPP_DEBUG_FLAGS) -std=c++11 -m64 -Wall -Werror -Wno-unused -Wno-unused-variable -I./dbg-mt -I. -I. -c foo.cpp -o dbg-mt/foo.o The only difference between these two commands (other than the input file) is the $(PCH_DEBUG_FLAGS) vs $(CPP_DEBUG_FLAGS). However, in order for the precompiled headers (.gch file) to be used when compiling the source files (e.g., foo.cpp), both of the following conditions must be met: 1) The '-g' or '-g2' or '-g3' flag must be used when building the precompiled headers (.gch file). 2) The '-g3' flag (and no less) must be used when compiling each TU (.c/.cpp file), and In other words: PCH_DEBUG_FLAGS = -g3 or -g2 or -g (specifying no 'g' at all will cause PCH cache to be ignored) CPP_DEBUG_FLAGS = -g3 (specifying -g2 or -g or no 'g' at all will cause PCH cache to be ignored) I put a #warning in the my_pch.hpp file to be sure of when PCH were being ignored (though, the long delay also made it quite obvious). This bug is present in all 3 versions of gcc I tested (4.7.2, 4.8.0, 4.8.1_20130427).
next reply other threads:[~2013-05-10 16:50 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-05-10 16:50 scottbaldwin at gmail dot com [this message] 2013-05-10 16:55 ` [Bug pch/57242] " pinskia at gcc dot gnu.org 2013-05-10 16:56 ` pinskia at gcc dot gnu.org 2013-05-10 17:15 ` scottbaldwin at gmail dot com 2013-05-10 18:33 ` [Bug pch/57242] precompiled headers ignored " scottbaldwin at gmail dot com 2013-05-13 8:53 ` rguenth at gcc dot gnu.org 2013-05-13 16:55 ` scottbaldwin at gmail dot com 2013-11-10 8:03 ` pinskia at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-57242-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).