Merge lp:~yao-codesourcery/gcc-linaro/4.4-fix-647597 into lp:gcc-linaro/4.4

Proposed by Yao Qi
Status: Merged
Merged at revision: 93563
Proposed branch: lp:~yao-codesourcery/gcc-linaro/4.4-fix-647597
Merge into: lp:gcc-linaro/4.4
Diff against target: 26 lines (+8/-0)
2 files modified
ChangeLog.linaro (+6/-0)
gcc/c-common.c (+2/-0)
To merge this branch: bzr merge lp:~yao-codesourcery/gcc-linaro/4.4-fix-647597
Reviewer Review Type Date Requested Status
Ulrich Weigand (community) Approve
Review via email: mp+37118@code.launchpad.net

Description of the change

The cause of this bug is that DECL_SOURCE_LOCATION (decl) is not set properly, and this patch is to address this problem.

No regression on x86_64. arm cross compiler can compile WAbstractArea.ii without any errors. Regression test is not run on ARM.

To post a comment you must log in.
Revision history for this message
Michael Hope (michaelh1) wrote :

Hi Yao. Could you ask someone in Linaro or CSL to review this please? Ulrich is a good candidate.

Why does this problem not appear in 4.5?

Revision history for this message
Yao Qi (yao-codesourcery) wrote :

> Hi Yao. Could you ask someone in Linaro or CSL to review this please? Ulrich
> is a good candidate.

I'll ping Ulrich or Julian to review it, when they get up.

>
> Why does this problem not appear in 4.5?

The problem is only on linaro 4.4. FSF 4.4 and 4.5 works well. Problem is introduced by backporting this patch http://gcc.gnu.org/viewcvs?view=revision&revision=157124 . Segmentation fault goes away once I revert this path. I am building FSF GCC r157124, to see if segmentation fault is there also.

Front-end is changed a lot between 4.4 and 4.5.

Revision history for this message
Ulrich Weigand (uweigand) wrote :

I'm wondering why you need the "if" here:

24 + if (DECL_SOURCE_LOCATION (decl) == UNKNOWN_LOCATION)
25 + DECL_SOURCE_LOCATION (decl) = loc;

Given that immediately before the call to (*make_fname_decl), input_location is unconditionally set to UNKNOWN_LOCATION, DECL_SOURCE_LOCATION (decl) should *always* be UNKNOWN_LOCATION here ...

Do you have any case where this DECL_SOURCE_LOCATION is something different here? If not, it seems to me it would be less confusing to leave the "if" out and unconditionally set the location.

Note that in current mainline, make_fname_decl is changed to take a location_t argument, which is then used to set the decl's location. This was done as part of the big diagnostics branch merge:
http://gcc.gnu.org/ml/gcc-cvs/2009-06/msg00422.html
So it seems your patch is doing the right thing.

Revision history for this message
Yao Qi (yao-codesourcery) wrote :

> I'm wondering why you need the "if" here:
>
> 24 + if (DECL_SOURCE_LOCATION (decl) == UNKNOWN_LOCATION)
> 25 + DECL_SOURCE_LOCATION (decl) = loc;
>
> Given that immediately before the call to (*make_fname_decl), input_location
> is unconditionally set to UNKNOWN_LOCATION, DECL_SOURCE_LOCATION (decl) should
> *always* be UNKNOWN_LOCATION here ...
>
> Do you have any case where this DECL_SOURCE_LOCATION is something different
> here? If not, it seems to me it would be less confusing to leave the "if" out
> and unconditionally set the location.
>

No, I don't have such case. The reason I put "if" here is that I am little worried
that input_location is changed somewhere else, after it is set to UNKNOWN_LOCATION.
Because global variable input_location is modified in many places in current c/cpp
front end.

I've removed that "if" statement. Regression tested again on x86_64. Rebuild ARM cross compiler, no segmentation fault. I'll check in.

> Note that in current mainline, make_fname_decl is changed to take a location_t
> argument, which is then used to set the decl's location. This was done as
> part of the big diagnostics branch merge:
> http://gcc.gnu.org/ml/gcc-cvs/2009-06/msg00422.html
> So it seems your patch is doing the right thing.

I planed to backport this big patch before, but gave up after some hours, since it is not
as easy as I firstly imagined.

Revision history for this message
Yao Qi (yao-codesourcery) wrote :

Ulrich, please approve this merge request, then, I can check it in to linaro 4.4 tree.

Revision history for this message
Ulrich Weigand (uweigand) wrote :

This is OK, thanks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ChangeLog.linaro'
2--- ChangeLog.linaro 2010-09-25 04:58:28 +0000
3+++ ChangeLog.linaro 2010-10-01 13:29:26 +0000
4@@ -1,3 +1,9 @@
5+2010-09-30 Yao Qi <yao@codesourcery.com>
6+
7+ Fix LP:#647597
8+ gcc/
9+ * c-common.c (fname_decl): Update decl's source location.
10+
11 2010-09-24 Yao Qi <yao@codesourcery.com>
12
13 Backport from FSF to fix ICE found in LP:635409:
14
15=== modified file 'gcc/c-common.c'
16--- gcc/c-common.c 2010-09-07 14:49:43 +0000
17+++ gcc/c-common.c 2010-10-01 13:29:26 +0000
18@@ -1025,6 +1025,8 @@
19 if (!IS_EMPTY_STMT (stmts))
20 saved_function_name_decls
21 = tree_cons (decl, stmts, saved_function_name_decls);
22+ DECL_SOURCE_LOCATION (decl) = loc;
23+
24 *fname_vars[ix].decl = decl;
25 input_location = saved_location;
26 }

Subscribers

People subscribed via source and target branches