public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug modula2/109264] New: Compiler hangs trying to resolve opaque type
@ 2023-03-23 15:41 gaius at gcc dot gnu.org
  2023-03-23 15:42 ` [Bug modula2/109264] " gaius at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: gaius at gcc dot gnu.org @ 2023-03-23 15:41 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109264
           Summary: Compiler hangs trying to resolve opaque type
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: modula2
          Assignee: gaius at gcc dot gnu.org
          Reporter: gaius at gcc dot gnu.org
  Target Milestone: ---

Created attachment 54736
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54736&action=edit
Test module which provokes the bug

gm2 hangs if it compiles a module using an opaque type whose implementation
module contains a set.  For example see attachment and the following library
files:

DEFINITION MODULE stressset ;

TYPE
   dataType ;

END stressset.

----o<----o<----o<----o<----o<----o<----o<

IMPLEMENTATION MODULE stressset ;

TYPE
   enum = (red, blue, green) ;

CONST
   (* max = ORD (MAX (enum)) + 1 ; *)
   max = MAX (enum) + 1 ;


TYPE
   dataType = POINTER TO RECORD
                            next    : dataType ;
                            contents: ARRAY [0..max] OF CARDINAL ;
                            set     : SET OF enum ;
                         END ;

END stressset.

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

* [Bug modula2/109264] Compiler hangs trying to resolve opaque type
  2023-03-23 15:41 [Bug modula2/109264] New: Compiler hangs trying to resolve opaque type gaius at gcc dot gnu.org
@ 2023-03-23 15:42 ` gaius at gcc dot gnu.org
  2023-03-23 15:46 ` gaius at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: gaius at gcc dot gnu.org @ 2023-03-23 15:42 UTC (permalink / raw)
  To: gcc-bugs

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

Gaius Mulley <gaius at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-03-23
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1

--- Comment #1 from Gaius Mulley <gaius at gcc dot gnu.org> ---
Reproduced on x86_64 and aarch64 systems.

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

* [Bug modula2/109264] Compiler hangs trying to resolve opaque type
  2023-03-23 15:41 [Bug modula2/109264] New: Compiler hangs trying to resolve opaque type gaius at gcc dot gnu.org
  2023-03-23 15:42 ` [Bug modula2/109264] " gaius at gcc dot gnu.org
@ 2023-03-23 15:46 ` gaius at gcc dot gnu.org
  2023-03-23 16:42 ` cvs-commit at gcc dot gnu.org
  2023-03-23 16:43 ` gaius at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: gaius at gcc dot gnu.org @ 2023-03-23 15:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Gaius Mulley <gaius at gcc dot gnu.org> ---
Created attachment 54737
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54737&action=edit
Proposed fix

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

* [Bug modula2/109264] Compiler hangs trying to resolve opaque type
  2023-03-23 15:41 [Bug modula2/109264] New: Compiler hangs trying to resolve opaque type gaius at gcc dot gnu.org
  2023-03-23 15:42 ` [Bug modula2/109264] " gaius at gcc dot gnu.org
  2023-03-23 15:46 ` gaius at gcc dot gnu.org
@ 2023-03-23 16:42 ` cvs-commit at gcc dot gnu.org
  2023-03-23 16:43 ` gaius at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-03-23 16:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Gaius Mulley <gaius@gcc.gnu.org>:

https://gcc.gnu.org/g:5ededfa5b23781c3be6fcf6bb373418aa8bd6541

commit r13-6835-g5ededfa5b23781c3be6fcf6bb373418aa8bd6541
Author: Gaius Mulley <gaiusmod2@gmail.com>
Date:   Thu Mar 23 16:37:11 2023 +0000

    PR modula2/109264 Bugfix resolve opaque types containing sets

    Resolve opaque type handling.  The bug is caused by the compiler
    attempting to resolve the meta types of a constant constructor.
    It incorrectly attempts to get the type on an enumeration type
    (resulting in NulSym) which causes the meta resolver to spin.
    Some PHBuild rules (building records need to be copied from P3Build
    so that hidden types are resolved in order across the compile.

    gcc/m2/ChangeLog:

            PR modula2/109264
            * gm2-compiler/M2Quads.mod (BuildConstFunctionCall): Comment
            out ErrorString in debugging block.
            (BuildConstructorStart): Replace Assert with a call to
            MetaErrorT3.  Import MetaErrorT3.
            * gm2-compiler/PCSymBuild.mod (buildConstFunction): Rename
            local variables.
            (WalkFunctionParam): Remove test for IsEnumeration when
            resolving MIN or MAX parameters.
            * gm2-compiler/PHBuild.bnf (BlockAssert): New procedure.
            (ErrorArrayat): New procedure.
            (Expect): Renamed parameter t to tok.
            (PushQualident): New rule.
            (ConstSetOrQualidentOrFunction): Force AutoOn.
            (TypeDeclaration): Add debugging assert.
            (SimpleType): Add debugging assert.
            (DefaultRecordAttributes): New rule (and bugfix).
            (FieldPragmaExpression): New rule (and bugfix).
            (PragmaConstExpression): New rule (and bugfix).
            (SetOrDesignatorOrFunction): Add debugging assert.
            (Block): Add debugging assert.
            * gm2-gcc/m2expr.cc (m2expr_ConstantExpressionWarning): int
            to bool.
            * gm2-gcc/m2expr.h (m2expr_TreeOverflow): int to bool.
            (m2expr_GetBooleanTrue): Remove.
            (m2expr_GetBooleanFalse): Remove.
            * gm2-gcc/m2options.h (M2Options_SetStatistics): Replace
            int with bool.

    gcc/testsuite/ChangeLog:

            PR modula2/109264
            * gm2/iso/extended-opaque/pass/iso-extended-opaque-pass.exp:
            New test.
            * gm2/iso/extended-opaque/pass/stressset.def: New test.
            * gm2/iso/extended-opaque/pass/stressset.mod: New test.
            * gm2/iso/extended-opaque/pass/testset.mod: New test.
            * gm2/projects/iso/small/run/pass/iso-extended-opaque-run-pass.exp:
            New test.
            * gm2/projects/iso/small/run/pass/stressset.def: New test.
            * gm2/projects/iso/small/run/pass/stressset.mod: New test.
            * gm2/projects/iso/small/run/pass/test1.mod: New test.
            * gm2/projects/iso/small/run/pass/testlib.def: New test.
            * gm2/projects/iso/small/run/pass/testlib.mod: New test.
            * gm2/projects/iso/small/run/pass/testset.mod: New test.

    Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>

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

* [Bug modula2/109264] Compiler hangs trying to resolve opaque type
  2023-03-23 15:41 [Bug modula2/109264] New: Compiler hangs trying to resolve opaque type gaius at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-03-23 16:42 ` cvs-commit at gcc dot gnu.org
@ 2023-03-23 16:43 ` gaius at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: gaius at gcc dot gnu.org @ 2023-03-23 16:43 UTC (permalink / raw)
  To: gcc-bugs

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

Gaius Mulley <gaius at gcc dot gnu.org> changed:

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

--- Comment #4 from Gaius Mulley <gaius at gcc dot gnu.org> ---
Closing now the patch has been applied.

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

end of thread, other threads:[~2023-03-23 16:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-23 15:41 [Bug modula2/109264] New: Compiler hangs trying to resolve opaque type gaius at gcc dot gnu.org
2023-03-23 15:42 ` [Bug modula2/109264] " gaius at gcc dot gnu.org
2023-03-23 15:46 ` gaius at gcc dot gnu.org
2023-03-23 16:42 ` cvs-commit at gcc dot gnu.org
2023-03-23 16:43 ` gaius 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).