Irrespective of the use of -o this so far resulted in "error: output filename specified twice", since cc1_options already produces a -o option when -S was specified.
gcc/ 2016-07-01 Jan Beulich <jbeul...@suse.com> * varasm.c (get_variable_section): Validate initializer in named .bss-like sections. gcc/testsuite/ 2016-07-01 Jan Beulich <jbeul...@suse.com> * gcc.dg/bss.c: New. --- 2016-06-30/gcc/cp/lang-specs.h +++ 2016-06-30/gcc/cp/lang-specs.h @@ -47,7 +47,7 @@ along with GCC; see the file COPYING3. cc1plus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.ii} %{!save-temps*:%g.ii}}\ %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\ %(cc1_options) %2\ - %{!fsyntax-only:-o %g.s \ + %{!fsyntax-only:%{!S:-o %g.s} \ %{!fdump-ada-spec*:%{!o*:--output-pch=%i.gch}\ %W{o*:--output-pch=%*}}%V}}}}", CPLUSPLUS_CPP_SPEC, 0, 0}, --- 2016-06-30/gcc/gcc.c +++ 2016-06-30/gcc/gcc.c @@ -1330,7 +1330,7 @@ static const struct compiler default_com %W{o*:--output-pch=%*}}%V}}\ %{!save-temps*:%{!traditional-cpp:%{!no-integrated-cpp:\ cc1 %(cpp_unique_options) %(cc1_options)\ - %{!fsyntax-only:-o %g.s \ + %{!fsyntax-only:%{!S:-o %g.s} \ %{!fdump-ada-spec*:%{!o*:--output-pch=%i.gch}\ %W{o*:--output-pch=%*}}%V}}}}}}}", 0, 0, 0}, {".i", "@cpp-output", 0, 0, 0}, --- 2016-06-30/gcc/testsuite/g++.dg/header.C +++ 2016-06-30/gcc/testsuite/g++.dg/header.C @@ -0,0 +1,9 @@ +/* This really should use "dg-do compile" without the -S in dg-options, + but the extra options get put after the input file in that case, and + hence the test would fail. */ +/* { dg-do assemble } */ +/* { dg-options "-S -x c++-header" } */ + +struct s { + unsigned field; +}; --- 2016-06-30/gcc/testsuite/gcc.dg/header.c +++ 2016-06-30/gcc/testsuite/gcc.dg/header.c @@ -0,0 +1,9 @@ +/* This really should use "dg-do compile" without the -S in dg-options, + but the extra options get put after the input file in that case, and + hence the test would fail. */ +/* { dg-do assemble } */ +/* { dg-options "-S -x c-header" } */ + +struct s { + unsigned field; +};