public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug modula2/108553] New: GM2 ICEs on mistyped command line options
@ 2023-01-26  8:29 rguenth at gcc dot gnu.org
  2023-01-26  8:32 ` [Bug modula2/108553] " rguenth at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-01-26  8:29 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108553

            Bug ID: 108553
           Summary: GM2 ICEs on mistyped command line options
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: modula2
          Assignee: gaius at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

When mistyping -Wreturn-type as -Wereturn-type the compiler ICEs because
we segfault in

#5  0x0000000000c19cfd in gm2_langhook_init_options (decoded_options_count=7, 
    decoded_options=0x429a190)
    at /home/rguenther/src/trunk/gcc/m2/gm2-lang.cc:296
296                   fprintf(stderr, "%s : %s\n", opt, (arg ? arg : ""));
(gdb) l
291               /* FALLTHROUGH */
292             default:
293               if (code >= N_OPTS)
294                 {
295                   // FIXME remove debug.
296                   fprintf(stderr, "%s : %s\n", opt, (arg ? arg : ""));
297                   break;
298                 }
299               /* Do not pass Modula-2 args to the preprocessor, any that we
care
300                  about here should already have been handled above.  */
(gdb) p opt
$2 = 0x6874616d5f656661 <error: Cannot access memory at address
0x6874616d5f656661>

Note code is OPT_SPECIAL_unknown here.

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

* [Bug modula2/108553] GM2 ICEs on mistyped command line options
  2023-01-26  8:29 [Bug modula2/108553] New: GM2 ICEs on mistyped command line options rguenth at gcc dot gnu.org
@ 2023-01-26  8:32 ` rguenth at gcc dot gnu.org
  2023-01-26  8:38 ` iains at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-01-26  8:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108553

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |iains at gcc dot gnu.org

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
diagnosing options in gm2_langhook_init_options is probably not the way to go.

Looks like this creeped in by recent refactoring?

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

* [Bug modula2/108553] GM2 ICEs on mistyped command line options
  2023-01-26  8:29 [Bug modula2/108553] New: GM2 ICEs on mistyped command line options rguenth at gcc dot gnu.org
  2023-01-26  8:32 ` [Bug modula2/108553] " rguenth at gcc dot gnu.org
@ 2023-01-26  8:38 ` iains at gcc dot gnu.org
  2023-01-26  9:10 ` iains at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: iains at gcc dot gnu.org @ 2023-01-26  8:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108553

--- Comment #2 from Iain Sandoe <iains at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #1)
> diagnosing options in gm2_langhook_init_options is probably not the way to
> go.
> 
> Looks like this creeped in by recent refactoring?

Yeah, there is no intention to diagnose options here, that was debugging code
that was not removed.

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

* [Bug modula2/108553] GM2 ICEs on mistyped command line options
  2023-01-26  8:29 [Bug modula2/108553] New: GM2 ICEs on mistyped command line options rguenth at gcc dot gnu.org
  2023-01-26  8:32 ` [Bug modula2/108553] " rguenth at gcc dot gnu.org
  2023-01-26  8:38 ` iains at gcc dot gnu.org
@ 2023-01-26  9:10 ` iains at gcc dot gnu.org
  2023-01-26  9:46 ` marxin at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: iains at gcc dot gnu.org @ 2023-01-26  9:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108553

--- Comment #3 from Iain Sandoe <iains at gcc dot gnu.org> ---
I'm trying to reproduce this - in the meantime does the obvious fix solve the
problem for you?

diff --cc gcc/m2/gm2-lang.cc
index 4d9cae205a7,4d9cae205a7..a30e626620c
--- a/gcc/m2/gm2-lang.cc
+++ b/gcc/m2/gm2-lang.cc
@@@ -290,12 -290,12 +290,9 @@@ gm2_langhook_init_options (unsigned in
          M2Options_SetVerbose (value);
          /* FALLTHROUGH */
        default:
++        /* We handled input files above.  */
          if (code >= N_OPTS)
--          {
--            // FIXME remove debug.
--            fprintf(stderr, "%s : %s\n", opt, (arg ? arg : ""));
--            break;
--          }
++          break;
          /* Do not pass Modula-2 args to the preprocessor, any that we care
             about here should already have been handled above.  */
          if (option->flags & CL_ModulaX2)

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

* [Bug modula2/108553] GM2 ICEs on mistyped command line options
  2023-01-26  8:29 [Bug modula2/108553] New: GM2 ICEs on mistyped command line options rguenth at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-01-26  9:10 ` iains at gcc dot gnu.org
@ 2023-01-26  9:46 ` marxin at gcc dot gnu.org
  2023-01-26 12:47 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2023-01-26  9:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108553

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
                 CC|                            |marxin at gcc dot gnu.org
   Last reconfirmed|                            |2023-01-26
             Status|UNCONFIRMED                 |NEW

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

* [Bug modula2/108553] GM2 ICEs on mistyped command line options
  2023-01-26  8:29 [Bug modula2/108553] New: GM2 ICEs on mistyped command line options rguenth at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-01-26  9:46 ` marxin at gcc dot gnu.org
@ 2023-01-26 12:47 ` rguenth at gcc dot gnu.org
  2023-01-26 16:30 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-01-26 12:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108553

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Iain Sandoe from comment #3)
> I'm trying to reproduce this - in the meantime does the obvious fix solve
> the problem for you?
> 
> diff --cc gcc/m2/gm2-lang.cc
> index 4d9cae205a7,4d9cae205a7..a30e626620c
> --- a/gcc/m2/gm2-lang.cc
> +++ b/gcc/m2/gm2-lang.cc
> @@@ -290,12 -290,12 +290,9 @@@ gm2_langhook_init_options (unsigned in
>           M2Options_SetVerbose (value);
>           /* FALLTHROUGH */
>         default:
> ++        /* We handled input files above.  */
>           if (code >= N_OPTS)
> --          {
> --            // FIXME remove debug.
> --            fprintf(stderr, "%s : %s\n", opt, (arg ? arg : ""));
> --            break;
> --          }
> ++          break;
>           /* Do not pass Modula-2 args to the preprocessor, any that we care
>              about here should already have been handled above.  */
>           if (option->flags & CL_ModulaX2)

Yes, that fixes the ICE and produces

cc1gm2: error: unrecognized command-line option '-Wereturn-type'

btw, the 'opt' variable is unused after the removal

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

* [Bug modula2/108553] GM2 ICEs on mistyped command line options
  2023-01-26  8:29 [Bug modula2/108553] New: GM2 ICEs on mistyped command line options rguenth at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2023-01-26 12:47 ` rguenth at gcc dot gnu.org
@ 2023-01-26 16:30 ` cvs-commit at gcc dot gnu.org
  2023-01-27  7:44 ` rguenth at gcc dot gnu.org
  2023-01-27  8:45 ` iains at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-01-26 16:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108553

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Iain D Sandoe <iains@gcc.gnu.org>:

https://gcc.gnu.org/g:6dd4578f4779b27b2115d78226ff7df46c939061

commit r13-5398-g6dd4578f4779b27b2115d78226ff7df46c939061
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Thu Jan 26 09:46:32 2023 +0000

    Modula-2: Remove debug code [PR108553].

    Remove debugging code accidentally left in place in
r13-5373-g80cf2c5e8f496b.

    Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

            PR modula2/108553

    gcc/m2/ChangeLog:

            * gm2-lang.cc (gm2_langhook_init_options): Remove debug code.

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

* [Bug modula2/108553] GM2 ICEs on mistyped command line options
  2023-01-26  8:29 [Bug modula2/108553] New: GM2 ICEs on mistyped command line options rguenth at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2023-01-26 16:30 ` cvs-commit at gcc dot gnu.org
@ 2023-01-27  7:44 ` rguenth at gcc dot gnu.org
  2023-01-27  8:45 ` iains at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-01-27  7:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108553

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to CVS Commits from comment #5)
> The master branch has been updated by Iain D Sandoe <iains@gcc.gnu.org>:
> 
> https://gcc.gnu.org/g:6dd4578f4779b27b2115d78226ff7df46c939061
> 
> commit r13-5398-g6dd4578f4779b27b2115d78226ff7df46c939061
> Author: Iain Sandoe <iain@sandoe.co.uk>
> Date:   Thu Jan 26 09:46:32 2023 +0000
> 
>     Modula-2: Remove debug code [PR108553].
>     
>     Remove debugging code accidentally left in place in
> r13-5373-g80cf2c5e8f496b.
>     
>     Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
>     
>             PR modula2/108553
>     
>     gcc/m2/ChangeLog:
>     
>             * gm2-lang.cc (gm2_langhook_init_options): Remove debug code.

You should now see an unused variable diagnostic about 'opt', but the ICE is
gone.  Thanks.

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

* [Bug modula2/108553] GM2 ICEs on mistyped command line options
  2023-01-26  8:29 [Bug modula2/108553] New: GM2 ICEs on mistyped command line options rguenth at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2023-01-27  7:44 ` rguenth at gcc dot gnu.org
@ 2023-01-27  8:45 ` iains at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: iains at gcc dot gnu.org @ 2023-01-27  8:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108553

--- Comment #7 from Iain Sandoe <iains at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #6)
> (In reply to CVS Commits from comment #5)
> > The master branch has been updated by Iain D Sandoe <iains@gcc.gnu.org>:

> 
> You should now see an unused variable diagnostic about 'opt', but the ICE is
> gone.  Thanks.

Hmm that's surprising 'opt' is used in several calls like so:
          M2Options_CppArg (opt, arg, (option->flags & CL_JOINED)
                              && !(option->flags & CL_SEPARATE));

I wonder what is causing that diagnostic?


(bootstrap succeeded for me without disabling Werror .. so it does not seem to
show on Darwin)

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

end of thread, other threads:[~2023-01-27  8:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-26  8:29 [Bug modula2/108553] New: GM2 ICEs on mistyped command line options rguenth at gcc dot gnu.org
2023-01-26  8:32 ` [Bug modula2/108553] " rguenth at gcc dot gnu.org
2023-01-26  8:38 ` iains at gcc dot gnu.org
2023-01-26  9:10 ` iains at gcc dot gnu.org
2023-01-26  9:46 ` marxin at gcc dot gnu.org
2023-01-26 12:47 ` rguenth at gcc dot gnu.org
2023-01-26 16:30 ` cvs-commit at gcc dot gnu.org
2023-01-27  7:44 ` rguenth at gcc dot gnu.org
2023-01-27  8:45 ` iains at gcc dot gnu.org

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).