This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] Fix for PR58201
- From: Paolo Carlini <paolo dot carlini at oracle dot com>
- To: Jan Hubicka <hubicka at ucw dot cz>
- Cc: Richard Biener <rguenther at suse dot de>, Bernd Schmidt <bernds at codesourcery dot com>, gcc-patches at gcc dot gnu dot org, jason at redhat dot com
- Date: Sat, 07 Sep 2013 12:13:11 +0200
- Subject: Re: [RFC] Fix for PR58201
- Authentication-results: sourceware.org; auth=none
- References: <20130904160409 dot GF20687 at kam dot mff dot cuni dot cz> <52276493 dot 9070706 at codesourcery dot com> <20130904170918 dot GI20687 at kam dot mff dot cuni dot cz> <c1c2f51e-89b8-4632-a075-3f82464e973c at email dot android dot com> <20130905230516 dot GB14285 at kam dot mff dot cuni dot cz> <5229FC71 dot 2090709 at oracle dot com> <20130907080308 dot GA8074 at kam dot mff dot cuni dot cz> <20130907082846 dot GC4841 at kam dot mff dot cuni dot cz>
Hi
>What I can think of is to hide the stale source location when it no
>longer have
>defined meaning:
>Index: cgraphunit.c
>===================================================================
>--- cgraphunit.c (revision 202352)
>+++ cgraphunit.c (working copy)
>@@ -913,6 +913,7 @@ analyze_functions (void)
>
> bitmap_obstack_initialize (NULL);
> cgraph_state = CGRAPH_STATE_CONSTRUCTION;
>+ input_location = UNKNOWN_LOCATION;
>
>/* Ugly, but the fixup can not happen at a time same body alias is
>created;
> C++ FE is confused about the COMDAT groups being right. */
>
>but of course this just leads to:
>jh@gcc10:~/trunk/build7/gcc$ ./xgcc -B ./ -O2
>../../gcc/testsuite/g++.dg/template/cond2.C
>../../gcc/testsuite/g++.dg/template/cond2.C: In instantiation of 'int
>test(c<(X ? : Y)>&) [with int X = 0; int Y = 2]':
>:0:0: required from here
>../../gcc/testsuite/g++.dg/template/cond2.C:6:28: error: omitted middle
>operand to '?:' operand cannot be mangled
>template<int X, int Y> int test(c<X ? : Y>&); // { dg-error "omitted" }
Actually this kind of change makes a lot of sense to me (cmp clang too): since at that point we do *not* really know the location of the "required from" bit, just plainly admit it. Would it be possible in such cases to have a conditional in the diagnostic machinery and avoid the output of that bit completely when the location is UNKNOWN? I don't think there are existing cases where it's sane to say :0:0 as "required from"!?!
Short term at least, it would seem a good enough solution to me + a comment in testcase too.
Then indeed as you explained in your last message before leaving (enjoy Pisa! All in all I spent there ~10 years!) we should audit, avoid as much as possible such late diagnostic, etc.
What do you think?
Paolo