Commit bfd67b47 by Richard Biener Committed by Richard Biener

re PR c++/61564 (#pragma GCC optimize ("-fno-lto") causes the compiler to crash)

2016-06-07  Richard Biener  <rguenther@suse.de>

	PR c/61564
	* c-common.c (parse_optimize_options): Only apply CL_OPTIMIZATION
	options and warn about others.
	* common.opt (ffast-math): Make Optimization.

	* gcc.dg/Wpragmas-1.c: New testcase.
	* gcc.dg/Wattributes-4.c: Likewise.
	* gcc.dg/ipa/pr70646.c: Drop optimize pragma in favor of dg-option
	entry.

From-SVN: r237174
parent 6dc04658
2016-06-07 Richard Biener <rguenther@suse.de>
PR c/61564
* common.opt (ffast-math): Make Optimization.
2016-06-07 Simon Dardis <simon.dardis@imgtec.com>
Prachi Godbole <prachi.godbole@imgtec.com>
......
2016-06-07 Richard Biener <rguenther@suse.de>
PR c/61564
* c-common.c (parse_optimize_options): Only apply CL_OPTIMIZATION
options and warn about others.
2016-06-01 Eduard Sanou <dhole@openmailbox.org>
* c-common.c (get_source_date_epoch): Rename to
......
......@@ -9580,6 +9580,29 @@ parse_optimize_options (tree args, bool attr_p)
decode_cmdline_options_to_array_default_mask (opt_argc, opt_argv,
&decoded_options,
&decoded_options_count);
/* Drop non-Optimization options. */
unsigned j = 1;
for (i = 1; i < decoded_options_count; ++i)
{
if (! (cl_options[decoded_options[i].opt_index].flags & CL_OPTIMIZATION))
{
ret = false;
if (attr_p)
warning (OPT_Wattributes,
"bad option %s to optimize attribute",
decoded_options[i].orig_option_with_args_text);
else
warning (OPT_Wpragmas,
"bad option %s to pragma attribute",
decoded_options[i].orig_option_with_args_text);
continue;
}
if (i != j)
decoded_options[j] = decoded_options[i];
j++;
}
decoded_options_count = j;
/* And apply them. */
decode_options (&global_options, &global_options_set,
decoded_options, decoded_options_count,
input_location, global_dc);
......
......@@ -1287,7 +1287,7 @@ EnumValue
Enum(excess_precision) String(standard) Value(EXCESS_PRECISION_STANDARD)
ffast-math
Common
Common Optimization
ffat-lto-objects
Common Var(flag_fat_lto_objects)
......
2016-06-07 Richard Biener <rguenther@suse.de>
PR c/61564
* gcc.dg/Wpragmas-1.c: New testcase.
* gcc.dg/Wattributes-4.c: Likewise.
* gcc.dg/ipa/pr70646.c: Drop optimize pragma in favor of dg-option
entry.
2016-06-07 Christophe Lyon <christophe.lyon@linaro.org>
* gcc.target/aarch64/advsimd-intrinsics/p64_p128.c: Remove
......
/* { dg-do compile } */
int __attribute__((optimize("no-lto"))) main(void){return 0;} /* { dg-warning "bad option" } */
/* { dg-do compile } */
#pragma GCC push_options
#pragma GCC optimize ("-fno-lto") /* { dg-warning "bad option" } */
int main(void){return 0;}
#pragma GCC pop_options
/* ??? The FEs still apply the pragma string as optimize attribute to
all functions thus the diagnostic will be repeated for each function
affected. */
/* { dg-message "bad option" "" { target *-*-* } 0 } */
/* { dg-do run } */
/* { dg-options "-O2" } */
#pragma GCC optimize("no-unit-at-a-time")
/* { dg-options "-O2 -fno-unit-at-a-time" } */
typedef unsigned char u8;
typedef unsigned long long u64;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment