Message ID | CAFiYyc2QKfR=J5V-VF7HSJ_mnVNARtw+d_i33YaHG5dYehFNig@mail.gmail.com |
---|---|
State | New |
Headers | show |
On Tue, Jan 17, 2012 at 3:35 AM, Richard Guenther <richard.guenther@gmail.com> wrote: > On Mon, Jan 16, 2012 at 10:29 PM, Jason Merrill <jason@redhat.com> wrote: >> When outputting PCH/LTO, the compiler tries to generate mangled names for >> all decls before discarding language-specific data. But that doesn't make >> sense for templates, and leads to conflicts in this case. Fixed by refusing >> to mangle templates. >> >> Tested x86_64-pc-linux-gnu, applying to trunk. > > Hmm. Using -flto when generating a precompiled header doesn't make sense. > We probably should drop -flto silently or complain here. Thus, > > Index: c-family/c-opts.c > =================================================================== > --- c-family/c-opts.c (revision 183205) > +++ c-family/c-opts.c (working copy) > @@ -1058,6 +1058,13 @@ c_common_post_options (const char **pfil > && flag_preprocess_only && !flag_no_line_commands) > pp_dir_change (parse_in, get_src_pwd ()); > > + /* Disable LTO output when outputting a precompiled header. */ > + if (pch_file && flag_lto) > + { > + flag_lto = 0; > + flag_generate_lto = 0; > + } > + > return flag_preprocess_only; > } > > any objection to that? I think we should issue a diagnostic about the combination of these two flags. Silent ignorance would lead to false user expectations and supposed "bug" reports, if not confusion. -- Gaby
On Tue, Jan 17, 2012 at 04:35, Richard Guenther <richard.guenther@gmail.com> wrote: > + /* Disable LTO output when outputting a precompiled header. */ > + if (pch_file && flag_lto) > + { > + flag_lto = 0; > + flag_generate_lto = 0; > + } > + Emit a warning when you do this? Diego.
On Tue, Jan 17, 2012 at 2:23 PM, Diego Novillo <dnovillo@google.com> wrote: > On Tue, Jan 17, 2012 at 04:35, Richard Guenther > <richard.guenther@gmail.com> wrote: > >> + /* Disable LTO output when outputting a precompiled header. */ >> + if (pch_file && flag_lto) >> + { >> + flag_lto = 0; >> + flag_generate_lto = 0; >> + } >> + > > Emit a warning when you do this? Well, I'd say peoples Makefiles may not strip -flto properly here (you need to pass optimization level for example), so I'm not sure that would be good QOI. > I think we should issue a diagnostic about the combination of these > two flags. Silent ignorance would lead to false user expectations > and supposed "bug" reports, if not confusion. I'm not sure what "expectation" there would be? OTOH the bug is fixed by Jason, so we can just do nothing. Richard.
On Tue, Jan 17, 2012 at 8:43 AM, Richard Guenther <richard.guenther@gmail.com> wrote: >> I think we should issue a diagnostic about the combination of these >> two flags. Silent ignorance would lead to false user expectations >> and supposed "bug" reports, if not confusion. > > I'm not sure what "expectation" there would be? that PCH works with LTO :-) (especially when PCH means precompiled header :-) -- Gaby
On Tue, Jan 17, 2012 at 3:50 PM, Gabriel Dos Reis <gdr@integrable-solutions.net> wrote: > On Tue, Jan 17, 2012 at 8:43 AM, Richard Guenther > <richard.guenther@gmail.com> wrote: > >>> I think we should issue a diagnostic about the combination of these >>> two flags. Silent ignorance would lead to false user expectations >>> and supposed "bug" reports, if not confusion. >> >> I'm not sure what "expectation" there would be? > > that PCH works with LTO :-) > > (especially when PCH means precompiled header :-) Sure it works. PCH is just a stage where LTO is not active yet. Richard. > -- Gaby
On 01/17/2012 09:51 AM, Richard Guenther wrote:
> Sure it works. PCH is just a stage where LTO is not active yet.
That makes sense to me.
Jason
On Tue, Jan 17, 2012 at 5:22 PM, Jason Merrill <jason@redhat.com> wrote: > On 01/17/2012 09:51 AM, Richard Guenther wrote: >> >> Sure it works. PCH is just a stage where LTO is not active yet. > > > That makes sense to me. Applied then. Richard. > Jason >
Index: c-family/c-opts.c =================================================================== --- c-family/c-opts.c (revision 183205) +++ c-family/c-opts.c (working copy) @@ -1058,6 +1058,13 @@ c_common_post_options (const char **pfil && flag_preprocess_only && !flag_no_line_commands) pp_dir_change (parse_in, get_src_pwd ()); + /* Disable LTO output when outputting a precompiled header. */ + if (pch_file && flag_lto) + { + flag_lto = 0; + flag_generate_lto = 0; + } + return flag_preprocess_only; }