diff mbox

Don't set dir prefix twice (PR middle-end/60484)

Message ID 20140314173827.GC6523@redhat.com
State New
Headers show

Commit Message

Marek Polacek March 14, 2014, 5:38 p.m. UTC
This patch makes sure that we set the directory prefix of
dump_base_name only once, otherwise we'd end up with invalid path,
resulting in error: could not open dump file ...
This happened because finish_options is called for every optimize
attribute and once more for command line options and every time it
added the directory prefix.

Regtested/bootstrapped on x86_64-linux, ok for trunk?

2014-03-14  Jakub Jelinek  <jakub@redhat.com>
	    Marek Polacek  <polacek@redhat.com>

	PR middle-end/60484
	* common.opt (dump_base_name_prefixed): New Variable.
	* opts.c (finish_options): Don't prepend directory to x_dump_base_name
	if x_dump_base_name_prefixed is already set, set it at the end.


	Marek

Comments

Joseph Myers March 14, 2014, 5:43 p.m. UTC | #1
On Fri, 14 Mar 2014, Marek Polacek wrote:

> This patch makes sure that we set the directory prefix of
> dump_base_name only once, otherwise we'd end up with invalid path,
> resulting in error: could not open dump file ...
> This happened because finish_options is called for every optimize
> attribute and once more for command line options and every time it
> added the directory prefix.
> 
> Regtested/bootstrapped on x86_64-linux, ok for trunk?

OK, though I think it might be better to use separate fields of 
gcc_options for the originally specified name and the prefixed version.
Joey Ye Aug. 14, 2014, 5:34 a.m. UTC | #2
PR60484 is marked as 4.7/4.8 regression and it is reported against 4.8
recently by an user.

OK backporting to 4.7/4.8?

- Joey

On Sat, Mar 15, 2014 at 1:43 AM, Joseph S. Myers
<joseph@codesourcery.com> wrote:
> On Fri, 14 Mar 2014, Marek Polacek wrote:
>
>> This patch makes sure that we set the directory prefix of
>> dump_base_name only once, otherwise we'd end up with invalid path,
>> resulting in error: could not open dump file ...
>> This happened because finish_options is called for every optimize
>> attribute and once more for command line options and every time it
>> added the directory prefix.
>>
>> Regtested/bootstrapped on x86_64-linux, ok for trunk?
>
> OK, though I think it might be better to use separate fields of
> gcc_options for the originally specified name and the prefixed version.
>
> --
> Joseph S. Myers
> joseph@codesourcery.com
Richard Biener Aug. 14, 2014, 10:36 a.m. UTC | #3
On Thu, Aug 14, 2014 at 7:34 AM, Joey Ye <joey.ye.cc@gmail.com> wrote:
> PR60484 is marked as 4.7/4.8 regression and it is reported against 4.8
> recently by an user.
>
> OK backporting to 4.7/4.8?

The 4.7 branch is closed.

Richard.

> - Joey
>
> On Sat, Mar 15, 2014 at 1:43 AM, Joseph S. Myers
> <joseph@codesourcery.com> wrote:
>> On Fri, 14 Mar 2014, Marek Polacek wrote:
>>
>>> This patch makes sure that we set the directory prefix of
>>> dump_base_name only once, otherwise we'd end up with invalid path,
>>> resulting in error: could not open dump file ...
>>> This happened because finish_options is called for every optimize
>>> attribute and once more for command line options and every time it
>>> added the directory prefix.
>>>
>>> Regtested/bootstrapped on x86_64-linux, ok for trunk?
>>
>> OK, though I think it might be better to use separate fields of
>> gcc_options for the originally specified name and the prefixed version.
>>
>> --
>> Joseph S. Myers
>> joseph@codesourcery.com
Joey Ye Aug. 18, 2014, 10:14 a.m. UTC | #4
OK to 4.8 then?

On Thu, Aug 14, 2014 at 6:36 PM, Richard Biener
<richard.guenther@gmail.com> wrote:
> On Thu, Aug 14, 2014 at 7:34 AM, Joey Ye <joey.ye.cc@gmail.com> wrote:
>> PR60484 is marked as 4.7/4.8 regression and it is reported against 4.8
>> recently by an user.
>>
>> OK backporting to 4.7/4.8?
>
> The 4.7 branch is closed.
>
> Richard.
>
>> - Joey
>>
>> On Sat, Mar 15, 2014 at 1:43 AM, Joseph S. Myers
>> <joseph@codesourcery.com> wrote:
>>> On Fri, 14 Mar 2014, Marek Polacek wrote:
>>>
>>>> This patch makes sure that we set the directory prefix of
>>>> dump_base_name only once, otherwise we'd end up with invalid path,
>>>> resulting in error: could not open dump file ...
>>>> This happened because finish_options is called for every optimize
>>>> attribute and once more for command line options and every time it
>>>> added the directory prefix.
>>>>
>>>> Regtested/bootstrapped on x86_64-linux, ok for trunk?
>>>
>>> OK, though I think it might be better to use separate fields of
>>> gcc_options for the originally specified name and the prefixed version.
>>>
>>> --
>>> Joseph S. Myers
>>> joseph@codesourcery.com
diff mbox

Patch

diff --git gcc/common.opt gcc/common.opt
index 661516d..d8918d1 100644
--- gcc/common.opt
+++ gcc/common.opt
@@ -211,6 +211,10 @@  bool flag_opts_finished
 Variable
 unsigned int flag_sanitize
 
+; Flag whether a prefix has been added to dump_base_name
+Variable
+bool dump_base_name_prefixed = false
+
 ###
 Driver
 
diff --git gcc/opts.c gcc/opts.c
index 5dd442f..41c1a73 100644
--- gcc/opts.c
+++ gcc/opts.c
@@ -645,7 +645,9 @@  finish_options (struct gcc_options *opts, struct gcc_options *opts_set,
 {
   enum unwind_info_type ui_except;
 
-  if (opts->x_dump_base_name && ! IS_ABSOLUTE_PATH (opts->x_dump_base_name))
+  if (opts->x_dump_base_name
+      && ! IS_ABSOLUTE_PATH (opts->x_dump_base_name)
+      && ! opts->x_dump_base_name_prefixed)
     {
       /* First try to make OPTS->X_DUMP_BASE_NAME relative to the
 	 OPTS->X_DUMP_DIR_NAME directory.  Then try to make
@@ -675,6 +677,7 @@  finish_options (struct gcc_options *opts, struct gcc_options *opts_set,
 	      opts->x_dump_base_name = new_dump_base_name;
 	    }
 	}
+	opts->x_dump_base_name_prefixed = true;
     }
 
   /* Handle related options for unit-at-a-time, toplevel-reorder, and