public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Fix PR 67665: ICE when passing two empty files directly to cc1 with -g
@ 2016-01-13  8:27 Andrew Pinski
  2016-01-13 12:36 ` Richard Biener
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Pinski @ 2016-01-13  8:27 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 523 bytes --]

Hi,
  The support -combine was removed a while back but cc1 still accepts
more than one file if directly invoked.  The support for multiple
files has bit-rotten inside the C front-end now too.  This patch now
errors out when invoked with more than one file instead of crashing
later.

OK?  Bootstrapped and tested on aarch64-linux-gnu with no regressions.

Thanks,
Andrew Pinski

c-family/ChangeLog:
* c-opts.c (c_common_post_options): Move the error message about "two
or more source files" such that it is unconditional.

[-- Attachment #2: fix67665.diff.txt --]
[-- Type: text/plain, Size: 721 bytes --]

Index: c-family/c-opts.c
===================================================================
--- c-family/c-opts.c	(revision 232313)
+++ c-family/c-opts.c	(working copy)
@@ -928,6 +928,10 @@ c_common_post_options (const char **pfil
 #endif
     }
 
+  if (num_in_fnames > 1)
+    error ("too many filenames given.  Type %s --help for usage",
+	   progname);
+
   if (flag_preprocess_only)
     {
       /* Open the output now.  We must do so even if flag_no_output is
@@ -944,10 +948,6 @@ c_common_post_options (const char **pfil
 	  return false;
 	}
 
-      if (num_in_fnames > 1)
-	error ("too many filenames given.  Type %s --help for usage",
-	       progname);
-
       init_pp_output (out_stream);
     }
   else

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Fix PR 67665: ICE when passing two empty files directly to cc1 with -g
  2016-01-13  8:27 Fix PR 67665: ICE when passing two empty files directly to cc1 with -g Andrew Pinski
@ 2016-01-13 12:36 ` Richard Biener
  2016-01-22  1:17   ` Andrew Pinski
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Biener @ 2016-01-13 12:36 UTC (permalink / raw)
  To: Andrew Pinski; +Cc: GCC Patches

On Wed, Jan 13, 2016 at 9:27 AM, Andrew Pinski <pinskia@gmail.com> wrote:
> Hi,
>   The support -combine was removed a while back but cc1 still accepts
> more than one file if directly invoked.  The support for multiple
> files has bit-rotten inside the C front-end now too.  This patch now
> errors out when invoked with more than one file instead of crashing
> later.
>
> OK?  Bootstrapped and tested on aarch64-linux-gnu with no regressions.

Ok, but can you please simplify the following code then?  The

  i = 0;
  for (;;)
    {
...
      if (++i >= num_in_fnames)
        break;

and the code following the break should be no longer needed, no?

Thanks,
Richard.

> Thanks,
> Andrew Pinski
>
> c-family/ChangeLog:
> * c-opts.c (c_common_post_options): Move the error message about "two
> or more source files" such that it is unconditional.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Fix PR 67665: ICE when passing two empty files directly to cc1 with -g
  2016-01-13 12:36 ` Richard Biener
@ 2016-01-22  1:17   ` Andrew Pinski
  2016-01-22 11:04     ` Richard Biener
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Pinski @ 2016-01-22  1:17 UTC (permalink / raw)
  To: Richard Biener; +Cc: GCC Patches

On Wed, Jan 13, 2016 at 4:36 AM, Richard Biener
<richard.guenther@gmail.com> wrote:
> On Wed, Jan 13, 2016 at 9:27 AM, Andrew Pinski <pinskia@gmail.com> wrote:
>> Hi,
>>   The support -combine was removed a while back but cc1 still accepts
>> more than one file if directly invoked.  The support for multiple
>> files has bit-rotten inside the C front-end now too.  This patch now
>> errors out when invoked with more than one file instead of crashing
>> later.
>>
>> OK?  Bootstrapped and tested on aarch64-linux-gnu with no regressions.
>
> Ok, but can you please simplify the following code then?  The
>
>   i = 0;
>   for (;;)
>     {
> ...
>       if (++i >= num_in_fnames)
>         break;
>
> and the code following the break should be no longer needed, no?

Yes.  Let me resubmit the patch.  Also will this still be accepted
even though we are in stage 4?

Thanks,
Andrew Pinski

>
> Thanks,
> Richard.
>
>> Thanks,
>> Andrew Pinski
>>
>> c-family/ChangeLog:
>> * c-opts.c (c_common_post_options): Move the error message about "two
>> or more source files" such that it is unconditional.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Fix PR 67665: ICE when passing two empty files directly to cc1 with -g
  2016-01-22  1:17   ` Andrew Pinski
@ 2016-01-22 11:04     ` Richard Biener
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Biener @ 2016-01-22 11:04 UTC (permalink / raw)
  To: Andrew Pinski; +Cc: GCC Patches

On Fri, Jan 22, 2016 at 2:17 AM, Andrew Pinski <pinskia@gmail.com> wrote:
> On Wed, Jan 13, 2016 at 4:36 AM, Richard Biener
> <richard.guenther@gmail.com> wrote:
>> On Wed, Jan 13, 2016 at 9:27 AM, Andrew Pinski <pinskia@gmail.com> wrote:
>>> Hi,
>>>   The support -combine was removed a while back but cc1 still accepts
>>> more than one file if directly invoked.  The support for multiple
>>> files has bit-rotten inside the C front-end now too.  This patch now
>>> errors out when invoked with more than one file instead of crashing
>>> later.
>>>
>>> OK?  Bootstrapped and tested on aarch64-linux-gnu with no regressions.
>>
>> Ok, but can you please simplify the following code then?  The
>>
>>   i = 0;
>>   for (;;)
>>     {
>> ...
>>       if (++i >= num_in_fnames)
>>         break;
>>
>> and the code following the break should be no longer needed, no?
>
> Yes.  Let me resubmit the patch.  Also will this still be accepted
> even though we are in stage 4?

I suppose it's a regression, so yes.

Richard.

> Thanks,
> Andrew Pinski
>
>>
>> Thanks,
>> Richard.
>>
>>> Thanks,
>>> Andrew Pinski
>>>
>>> c-family/ChangeLog:
>>> * c-opts.c (c_common_post_options): Move the error message about "two
>>> or more source files" such that it is unconditional.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-01-22 11:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-13  8:27 Fix PR 67665: ICE when passing two empty files directly to cc1 with -g Andrew Pinski
2016-01-13 12:36 ` Richard Biener
2016-01-22  1:17   ` Andrew Pinski
2016-01-22 11:04     ` Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).