[Bug modula2/114529] profiledbootstrap fails to build and m2 causes odr violations during build

2024-05-21 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114529

--- Comment #3 from Gaius Mulley  ---
As an aid memoir the configure flags are:

../configure --prefix=$HOME/opt --enable-bootstrap
--with-build-config="bootstrap-O3 bootstrap-lto"
--enable-languages=c,c++,m2,lto

which provoke the odr violation.

m2/gm2-compiler-boot/M2Error.c:421:8: warning: type ‘struct
DynamicStrings_Contents_r’ violates the C++ One Definition Rule [-Wodr]
  421 | struct DynamicStrings_Contents_r {
  |^
m2/gm2-compiler-boot/M2GCCDeclare.c:708:8: note: a different type is defined in
another translation unit
  708 | struct DynamicStrings_Contents_r {
  |^
m2/gm2-compiler-boot/M2Error.c:422:55: note: the first difference of
corresponding definitions is field ‘buf’
  422 |DynamicStrings__T5 buf;

[Bug modula2/115164] floating-point output generates misleading values with WriteFloat when sigfigs and width are zero

2024-05-20 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115164

Gaius Mulley  changed:

   What|Removed |Added

   Last reconfirmed||2024-05-20
 Ever confirmed|0   |1
 Status|UNCONFIRMED |ASSIGNED

--- Comment #1 from Gaius Mulley  ---
Confirmed.

Using the Matula and Goldberg formulas makes much more sense than the current
default output for width 0.  I'll add these formulas to LowReal, LowShortReal,
LowLongReal (there is already a constant 'places', which looks as if it is
incorrect).

gcc/m2/gm2-gcc/m2builtins.cc:597:doplaces: looks wrong.  A Matula value
for sigfigs should be adopted in SRealIO and friends (if the width and sigfigs
are 0).

[Bug modula2/115164] New: floating-point output generates misleading values with WriteFloat when sigfigs and width are zero

2024-05-20 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115164

Bug ID: 115164
   Summary: floating-point output generates misleading values with
WriteFloat when sigfigs and width are zero
   Product: gcc
   Version: 15.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: ---

[Forwarded from the gm2 mailing list:
https://lists.nongnu.org/archive/html/gm2/2024-05/msg9.html ]

For example if we use WriteFloat (pi, 0, 0) then the libraries issue a long
sequence of zeros once the precision runs out.  Consider the test code and
output below:

cat testwritereal.mod
MODULE testwritereal ;

FROM STextIO IMPORT WriteString, WriteLn ;
FROM SRealIO IMPORT WriteFloat ;
FROM RealMath IMPORT pi ;

BEGIN
   WriteString ('value of pi = ') ; WriteFloat (pi, 0, 0) ; WriteLn
END testwritereal.

$ gm2 testwritereal.mod
$ ./a.out 
value of pi =
3141592653589793115997963468544185161590576171875

[Bug modula2/115112] New: Incorrect line debugging information occurs during INC builtin.

2024-05-15 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115112

Bug ID: 115112
   Summary: Incorrect line debugging information occurs during INC
builtin.
   Product: gcc
   Version: 15.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: ---

Similar to PR115111 the line number location appears wrong at the start of an
INC builtin (it steps to the procedure declaration).  It is likely that this
problem also occurs with DEC.  Again seen with the test code:

MODULE testrestline ;

IMPORT SeqFile, TextIO ;

VAR
   chan: SeqFile.ChanId ;
   line: ARRAY [0..5] OF CHAR ;
   results : SeqFile.OpenResults ;
BEGIN
   SeqFile.OpenWrite (chan, "test.input", SeqFile.write, results) ;
   TextIO.WriteString (chan, "a line of text exceeding 6 chars") ;
   TextIO.WriteLn (chan) ;
   TextIO.WriteString (chan, "a second lineline of text exceeding 6 chars") ;
   TextIO.WriteLn (chan) ;
   SeqFile.Close (chan) ;

   (* Now see if we can read the first line.  *)
   SeqFile.OpenRead (chan, "test.input", SeqFile.read, results) ;
   TextIO.ReadRestLine (chan, line)
END testrestline.

and the WHILE loop with an INC in procedure ReadRestLine.

[Bug modula2/115111] New: Incorrect line debugging locations at start of WHILE loop.

2024-05-15 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115111

Bug ID: 115111
   Summary: Incorrect line debugging locations at start of WHILE
loop.
   Product: gcc
   Version: 15.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: ---

The line debugging locations appear wrong at the start of a WHILE loop.
This can be seen when single stepping the following program using the
-fm2-whole-program -g options:

$ gm2 -fm2-whole-program -g -fiso testrestline.mod
$ cat testresline.mod
 MODULE testrestline ;

IMPORT SeqFile, TextIO ;

VAR
   chan: SeqFile.ChanId ;
   line: ARRAY [0..5] OF CHAR ;
   results : SeqFile.OpenResults ;
BEGIN
   SeqFile.OpenWrite (chan, "test.input", SeqFile.write, results) ;
   TextIO.WriteString (chan, "a line of text exceeding 6 chars") ;
   TextIO.WriteLn (chan) ;
   TextIO.WriteString (chan, "a second lineline of text exceeding 6 chars") ;
   TextIO.WriteLn (chan) ;
   SeqFile.Close (chan) ;

   (* Now see if we can read the first line.  *)
   SeqFile.OpenRead (chan, "test.input", SeqFile.read, results) ;
   TextIO.ReadRestLine (chan, line)
END testrestline.

The while loop behavior can be seen in TextIO.ReadRestLine.

[Bug modula2/115057] TextIO.ReadRestLine raise an exception for insufficient buffer

2024-05-15 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115057

Gaius Mulley  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #4 from Gaius Mulley  ---
Closing - thanks again for the bug report.

[Bug modula2/115057] TextIO.ReadRestLine raise an exception for insufficient buffer

2024-05-15 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115057

--- Comment #2 from Gaius Mulley  ---
Created attachment 58214
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58214=edit
Proposed fix

Here is a proposed fix - which I'll commit (if/when) a full bootstrap
completes.

[Bug modula2/115057] TextIO.ReadRestLine raise an exception for insufficient buffer

2024-05-15 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115057

Gaius Mulley  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
 Ever confirmed|0   |1
   Last reconfirmed||2024-05-15

--- Comment #1 from Gaius Mulley  ---
Confirmed thanks for the bug report.

[Bug modula2/115003] exporting a symbol to outer scope with a name clash causes ICE

2024-05-09 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115003

Gaius Mulley  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #4 from Gaius Mulley  ---
Closing now that the patch has been applied.

[Bug modula2/115003] exporting a symbol to outer scope with a name clash causes ICE

2024-05-09 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115003

--- Comment #2 from Gaius Mulley  ---
Created attachment 58143
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58143=edit
Proposed fix

The scope was an unknown symbol which was not in the case list within
SymbolTable.GetScope.
This patch adds a missing case clause allowing the compiler to recover.

$ gm2 Test.mod 
Test.mod:11:9: error: symbol ‘CardType’ is already declared in this scope, use
a different name or remove the declaration
   11 |  EXPORT CardType;
  | ^~~~
Test.mod:7:17: error: symbol ‘CardType’ also declared in this module
7 | TYPE CardType = CARDINAL;
  | ^~~~

[Bug modula2/115003] exporting a symbol to outer scope with a name clash causes ICE

2024-05-09 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115003

Gaius Mulley  changed:

   What|Removed |Added

 Ever confirmed|0   |1
 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2024-05-09

--- Comment #1 from Gaius Mulley  ---
Confirmed.

[Bug modula2/115003] New: exporting a symbol to outer scope with a name clash causes ICE

2024-05-09 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115003

Bug ID: 115003
   Summary: exporting a symbol to outer scope with a name clash
causes ICE
   Product: gcc
   Version: 15.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: ---

As reported on the gm2 mailing list, the following program causes an ICE:

MODULE Test;
(*
 * Produces internal compiler error
 * Inside SymbolTable.GetScope, GetPsym() returns an unexpected token.
 *)

TYPE CardType = CARDINAL;

 MODULE Inside;

 EXPORT CardType;

 END Inside;

END Test.

[Bug modula2/114133] problem passing a string pointer to a C function on solaris 32 bit and 64 bit

2024-05-07 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114133

Gaius Mulley  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #6 from Gaius Mulley  ---
Closing now that the patch has been applied.

[Bug modula2/113768] gm2/extensions/run/pass/vararg2.mod FAILs

2024-05-07 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113768

Gaius Mulley  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #4 from Gaius Mulley  ---
Closing now that the patch has been applied.

[Bug modula2/114929] for loop fails to iterate down to zero if a cardinal type (unsigned type) is used with a step of -1.

2024-05-03 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114929

Gaius Mulley  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #7 from Gaius Mulley  ---
Closing now the patch has been applied and back ported.

[Bug modula2/114929] for loop fails to iterate down to zero if a cardinal type (unsigned type) is used with a step of -1.

2024-05-02 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114929

Gaius Mulley  changed:

   What|Removed |Added

Version|14.0|15.0

--- Comment #4 from Gaius Mulley  ---
For completeness the test code at the top of the PR passes:

$ gm2 testforloopzero.mod 
$ ./a.out 
i = 5, count = 0
i = 4, count = 1
i = 3, count = 2
i = 2, count = 3
i = 1, count = 4
i = 0, count = 5
for loop counting down passed

[Bug modula2/114929] for loop fails to iterate down to zero if a cardinal type (unsigned type) is used with a step of -1.

2024-05-02 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114929

--- Comment #2 from Gaius Mulley  ---
Created attachment 58092
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58092=edit
Proposed fix

Here is a proposed bug fix with 6 for loop regression tests.

[Bug modula2/114929] for loop fails to iterate down to zero if a cardinal type (unsigned type) is used with a step of -1.

2024-05-02 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114929

Gaius Mulley  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2024-05-02
 Ever confirmed|0   |1

--- Comment #1 from Gaius Mulley  ---
Confirmed.

[Bug modula2/114929] New: for loop fails to iterate down to zero if a cardinal type (unsigned type) is used with a step of -1.

2024-05-02 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114929

Bug ID: 114929
   Summary: for loop fails to iterate down to zero if a cardinal
type (unsigned type) is used with a step of -1.
   Product: gcc
   Version: 14.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: ---

An example of the bug follows:

MODULE testforloopzero ;

FROM libc IMPORT printf, exit ;


(*
   test -
*)

PROCEDURE test ;
VAR
   i, n,
   count: CARDINAL ;
BEGIN
   n := 5 ;
   count := 0 ;
   FOR i := n TO 0 BY -1 DO
  printf ("i = %d, count = %d\n", i, count);
  INC (count)
   END ;
   IF count = 6
   THEN
  printf ("for loop counting down passed\n")
   ELSE
  printf ("for loop counting down failed\n") ;
  exit (1)
   END
END test ;


BEGIN
   test
END testforloopzero.

$ gm2 testforloopzero.mod
$ ./a.out

i = 5, count = 0
for loop counting down failed

[Bug modula2/113836] gm2 does not dump gimple or quadruples to a file

2024-05-02 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113836

Gaius Mulley  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #11 from Gaius Mulley  ---
Closing now the patch has been applied.

[Bug modula2/113836] gm2 does not dump gimple or quadruples to a file

2024-05-02 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113836

Gaius Mulley  changed:

   What|Removed |Added

  Attachment #57395|0   |1
is obsolete||

--- Comment #9 from Gaius Mulley  ---
Created attachment 58086
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58086=edit
Proposed fix

Here is the proposed patch implementing all the dump options (and symbol
filtering).

[Bug modula2/114836] error messages should be translatable and follow locale convention

2024-04-30 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114836

Gaius Mulley  changed:

   What|Removed |Added

 Ever confirmed|0   |1
 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2024-04-30

--- Comment #2 from Gaius Mulley  ---
Confirmed.

[Bug modula2/114836] New: error messages should be translatable and follow locale convention

2024-04-24 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114836

Bug ID: 114836
   Summary: error messages should be translatable and follow
locale convention
   Product: gcc
   Version: 14.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: ---

As mentioned on GCC patches the error messages should be translatable following
the technique used for gcc/po/gcc.pot.

[Bug modula2/114811] iso/fail/badexpression.mod and iso/fail/badexpression2.mod ICE

2024-04-22 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114811

Gaius Mulley  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #4 from Gaius Mulley  ---
Closing now the patch has been applied.

[Bug modula2/114811] iso/fail/badexpression.mod and iso/fail/badexpression2.mod ICE

2024-04-22 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114811

--- Comment #1 from Gaius Mulley  ---
Created attachment 58012
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58012=edit
Proposed fix

This patch fixes gm2-torture.exp to detect internal compiler error as a
negative result and also provides a bug fix to M2GenGCC.mod:FoldBinarySet. 
FoldBinarySet must only check types if the
operands have been resolved.  This ICE is seen when a string is attempted to be
included into a set.  See gcc/testsuite/gm2/iso/fail/badexpression2.mod.

[Bug modula2/114811] iso/fail/badexpression.mod and iso/fail/badexpression2.mod ICE

2024-04-22 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114811

Gaius Mulley  changed:

   What|Removed |Added

 Ever confirmed|0   |1
   Last reconfirmed||2024-04-22
 Status|UNCONFIRMED |ASSIGNED

--- Comment #2 from Gaius Mulley  ---
Confirmed.

[Bug modula2/114811] New: iso/fail/badexpression.mod and iso/fail/badexpression2.mod ICE

2024-04-22 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114811

Bug ID: 114811
   Summary: iso/fail/badexpression.mod and
iso/fail/badexpression2.mod ICE
   Product: gcc
   Version: 14.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: ---

Following on from PR 114807 it appears that gm2-torture.exp is reporting a fail
case ICE as a positive result.

[Bug modula2/114807] badpointer3.mod causes an ICE

2024-04-22 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114807

Gaius Mulley  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #4 from Gaius Mulley  ---
Closed now the patch has been applied.

[Bug modula2/114807] badpointer3.mod causes an ICE

2024-04-22 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114807

--- Comment #2 from Gaius Mulley  ---
Created attachment 58009
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58009=edit
Proposed fix

After the proposed patch fix is applied the cc1gm2 behaviour changes to:

$ gm2 -g -c badpointer3.mod 
badpointer3.mod:18:14: error: In procedure ‘foo’: 1st parameter type failure
between actual parameter type ‘Hello’ and the formal type ‘s’
   18 |testproc (Hello)
  |  ^
badpointer3.mod:18:14: error: ‘Hello’ and ‘s’ are incompatible as formal and
actual procedure parameters

[Bug modula2/114807] badpointer3.mod causes an ICE

2024-04-22 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114807

Gaius Mulley  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
 Ever confirmed|0   |1
   Last reconfirmed||2024-04-22

--- Comment #1 from Gaius Mulley  ---
Confirmed.

[Bug modula2/114807] New: badpointer3.mod causes an ICE

2024-04-22 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114807

Bug ID: 114807
   Summary: badpointer3.mod causes an ICE
   Product: gcc
   Version: 14.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: ---

The testsuite code: gcc/testsuite/gm2/pim/fail/badpointer3.mod causes an ICE.

$ gm2 badpointer3.mod 
cc1gm2: internal compiler error: assert failed
0x841537 m2linemap_internal_error
../../gcc/m2/gm2-gcc/m2linemap.cc:253
0x90c62b M2Emit_InternalError
m2/gm2-compiler-boot/M2Emit.c:102
0x87056b M2Error_InternalError
m2/gm2-compiler-boot/M2Error.c:2652
0x86e2ff M2Debug_Assert
m2/gm2-compiler-boot/M2Debug.c:63
0x8c7f07 SymbolTable_CopyConstString
m2/gm2-compiler-boot/SymbolTable.c:10522
0x8a0b6f MoveWithMode
m2/gm2-compiler-boot/M2Quads.c:7084
0x8a0b6f doBuildAssignment
m2/gm2-compiler-boot/M2Quads.c:7234

[Bug modula2/112893] gm2 fails to detect procedure address actual parameter is incompatible with cardinal formal parameter

2024-04-20 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112893

Gaius Mulley  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|REOPENED|RESOLVED

--- Comment #10 from Gaius Mulley  ---
Closing now the patch has been applied.

[Bug modula2/112893] gm2 fails to detect procedure address actual parameter is incompatible with cardinal formal parameter

2024-04-19 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112893

--- Comment #8 from Gaius Mulley  ---
Created attachment 57992
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57992=edit
Proposed fix v3

This patch creates a proctype for every procedure and then uses this associated
proctype during type checking.  M2Check.mod calls upon GetProcedureProcType
rather than assume a procedure is an ADDRESS type.  The patch also
changes/fixes some test code which assumed procedure/address types were the
same.

All regressions pass on x86_64 (non bootstrap, once full bootstrap completes
and passes the patch will be applied and the pr closed).

[Bug modula2/114745] const cast causes ICE

2024-04-17 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114745

Gaius Mulley  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #4 from Gaius Mulley  ---
Closing now the patch has been applied.

[Bug modula2/114745] const cast causes ICE

2024-04-16 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114745

--- Comment #2 from Gaius Mulley  ---
Created attachment 57964
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57964=edit
Proposed fix

Here is a proposed patch and the example test run:

$ gm2 -fiso -c -I. -I../ Dictionary.mod -fsources
Compiling: Dictionary.mod
Pass 0: lexical analysis, parsing, modules and associated filenames
   Module SYSTEM   :
/home/gaius/opt/lib/gcc/x86_64-pc-linux-gnu/14.0.1/m2/m2iso/SYSTEM.def [m2iso]
   Module M2RTS:
/home/gaius/opt/lib/gcc/x86_64-pc-linux-gnu/14.0.1/m2/m2iso/M2RTS.def [m2iso]
   Module RTExceptions :
/home/gaius/opt/lib/gcc/x86_64-pc-linux-gnu/14.0.1/m2/m2pim/RTExceptions.def
[m2pim]
   Module Dictionary   : ./Dictionary.def
   Module Dictionary   : Dictionary.mod
   Module String   : ../String.def
   Module Proc : ./Proc.def
   Module Storage  :
/home/gaius/opt/lib/gcc/x86_64-pc-linux-gnu/14.0.1/m2/m2iso/Storage.def [m2iso]
   Module StrBlank : ./StrBlank.def
Pass 1: scopes, enumerated types, imports and exports
Pass 2: constants and types
Pass C: aggregate constants
Pass 3: quadruple generation
Pass 4: gcc tree generation
symbols to gcc trees
statements to gcc trees
gcc trees given to the gcc backend

$ gm2 -fiso constcast.mod 
$

[Bug modula2/114745] const cast causes ICE

2024-04-16 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114745

Gaius Mulley  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
 Ever confirmed|0   |1
   Last reconfirmed||2024-04-16

--- Comment #1 from Gaius Mulley  ---
wrong test program (above).  The test which causes the ICE can be reduced to
the example here:

MODULE constcast ;

FROM SYSTEM IMPORT CAST ;

CONST Nil = CAST (PROC, NIL) ;

BEGIN
END constcast.

$ gm2 -fiso constcast.mod
cc1gm2: internal compiler error: symbol out of bounds
0x840837 m2linemap_internal_error
../../gcc/m2/gm2-gcc/m2linemap.cc:253
0x90b74b M2Emit_InternalError
m2/gm2-compiler-boot/M2Emit.c:102
0x86fa8b M2Error_InternalError
m2/gm2-compiler-boot/M2Error.c:2651
0x8d117b GetPsym
m2/gm2-compiler-boot/SymbolTable.c:4610
0x8d117b GetPsym
m2/gm2-compiler-boot/SymbolTable.c:4599
0x8d117b SymbolTable_IsSubrange
m2/gm2-compiler-boot/SymbolTable.c:18569
0x865587 M2Base_IsOrdinalType
m2/gm2-compiler-boot/M2Base.c:3195
0x8c05bf TypeToMeta
m2/gm2-compiler-boot/PCSymBuild.c:1173
0x8c05bf TypeToMeta
m2/gm2-compiler-boot/PCSymBuild.c:1152
0x8c13d7 buildConstFunction
m2/gm2-compiler-boot/PCSymBuild.c:1233
0x8c13d7 PCSymBuild_PushConstFunctionType
m2/gm2-compiler-boot/PCSymBuild.c:2698
0x8f5ebb ConstructorOrConstActualParameters
m2/gm2-compiler-boot/PCBuild.c:4460
0x8f5ebb ConstSetOrQualidentOrFunction
m2/gm2-compiler-boot/PCBuild.c:4508
0x8f5ebb ConstFactor
m2/gm2-compiler-boot/PCBuild.c:4251
0x8f5f3b ConstTerm
m2/gm2-compiler-boot/PCBuild.c:4085
0x8f6203 UnaryOrConstTerm
m2/gm2-compiler-boot/PCBuild.c:3977
0x8f6203 SimpleConstExpr
m2/gm2-compiler-boot/PCBuild.c:3929
0x8f648f ConstExpression
m2/gm2-compiler-boot/PCBuild.c:3812
0x8f66e7 ConstantDeclaration
m2/gm2-compiler-boot/PCBuild.c:3772
0x8f925f Declaration
m2/gm2-compiler-boot/PCBuild.c:7471
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug modula2/114745] New: const cast causes ICE

2024-04-16 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114745

Bug ID: 114745
   Summary: const cast causes ICE
   Product: gcc
   Version: 14.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: ---

As reported on the gm2 mailing list performing a cast in a const expression
causes an ICE.  The large original example from the mailing list has been
reduced to this smaller example:

MODULE tinyindr ;

FROM SYSTEM IMPORT WORD, BYTE ;

TYPE
   File = RECORD
 lastWord: WORD ;
 lastByte: BYTE ;
  END ;

PROCEDURE Create (VAR f: File) ;
BEGIN
   WITH f DO
  lastWord := WORD (0) ;
  lastByte := BYTE (0)
   END
END Create ;


VAR
   foo: File ;
BEGIN
   Create (foo)
END tinyindr.

[Bug modula2/114648] compiler by default does not handle C pre-processor file and line directives

2024-04-08 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114648

Gaius Mulley  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #6 from Gaius Mulley  ---
Closing now the patch has been applied.

[Bug modula2/114648] compiler by default does not handle C pre-processor file and line directives

2024-04-08 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114648

--- Comment #4 from Gaius Mulley  ---
Created attachment 57907
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57907=edit
Proposed fix

Trivial patch fix proposed with test code.

[Bug modula2/114648] compiler by default does not handle C pre-processor file and line directives

2024-04-08 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114648

--- Comment #3 from Gaius Mulley  ---
it will handle both, implemented in:  gcc/m2/m2.flex:171
but the default was inverted during a recent bugfix.
The particular test code example which provoked the bug was:

# 2 "AdvParse.bnf"
IMPLEMENTATION MODULE AdvParse ;

[Bug modula2/114648] compiler by default does not handle C pre-processor file and line directives

2024-04-08 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114648

Gaius Mulley  changed:

   What|Removed |Added

 Ever confirmed|0   |1
   Last reconfirmed||2024-04-09
 Status|UNCONFIRMED |ASSIGNED

--- Comment #1 from Gaius Mulley  ---
Confirmed.

[Bug modula2/114648] New: compiler by default does not handle C pre-processor file and line directives

2024-04-08 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114648

Bug ID: 114648
   Summary: compiler by default does not handle C pre-processor
file and line directives
   Product: gcc
   Version: 14.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: ---

The compiler currently rejects C preprocessor file and line directives which is
a mismatch from the description in the documentation.

[Bug modula2/114617] gm2 is unable to resolve const expression using relative operators ICE

2024-04-06 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114617

Gaius Mulley  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #5 from Gaius Mulley  ---
Closing now that the patch has been applied.

[Bug modula2/114617] gm2 is unable to resolve const expression using relative operators ICE

2024-04-06 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114617

--- Comment #3 from Gaius Mulley  ---
With the patch the reported failure examples above pass:

$ gm2 -g -c BasicFileSys.mod
-I../../../../Sandpit/gm2-outside-tree-tests/build/source/m2pp/src/ -fsources
Compiling: BasicFileSys.mod
Pass 0: lexical analysis, parsing, modules and associated filenames
   Module SYSTEM   :
/home/gaius/opt/lib/gcc/x86_64-pc-linux-gnu/14.0.1/m2/m2cor/SYSTEM.def [m2cor]
   Module M2RTS:
/home/gaius/opt/lib/gcc/x86_64-pc-linux-gnu/14.0.1/m2/m2pim/M2RTS.def [m2pim]
   Module RTExceptions :
/home/gaius/opt/lib/gcc/x86_64-pc-linux-gnu/14.0.1/m2/m2pim/RTExceptions.def
[m2pim]
   Module BasicFileSys :
../../../../Sandpit/gm2-outside-tree-tests/build/source/m2pp/src/BasicFileSys.def
   Module BasicFileSys : BasicFileSys.mod
   Module COROUTINES   :
/home/gaius/opt/lib/gcc/x86_64-pc-linux-gnu/14.0.1/m2/m2pim/COROUTINES.def
[m2pim] (for C)
   Module Size : ./Size.def
   Module stat : ./stat.def
   Module stdio: ./stdio.def (for C)
   Module unistd   : ./unistd.def (for C)
   Module fcntl: ./fcntl.def (for C)
   Module stat0: ./stat0.def (for C)
   Module SysTypes : ./SysTypes.def
Pass 1: scopes, enumerated types, imports and exports
Pass 2: constants and types
Pass C: aggregate constants
Pass 3: quadruple generation
Pass 4: gcc tree generation
symbols to gcc trees
statements to gcc trees
gcc trees given to the gcc backend

and

$ gm2 -c -fiso constbool3.mod

[Bug modula2/114617] gm2 is unable to resolve const expression using relative operators ICE

2024-04-05 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114617

--- Comment #2 from Gaius Mulley  ---
Created attachment 57891
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57891=edit
Proposed fix

Here is a proposed fix which stores the result of the relop as a constant.
The fix requires M2Quads to mark a const expression relop and M2GenGCC to
evaluate the relop and then to remove the redundant quadruples.

[Bug modula2/114617] gm2 is unable to resolve const expression using relative operators ICE

2024-04-05 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114617

Gaius Mulley  changed:

   What|Removed |Added

   Last reconfirmed||2024-04-06
 Ever confirmed|0   |1
 Status|UNCONFIRMED |ASSIGNED

--- Comment #1 from Gaius Mulley  ---
Confirmed.

[Bug modula2/114617] New: gm2 is unable to resolve const expression using relative operators ICE

2024-04-05 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114617

Bug ID: 114617
   Summary: gm2 is unable to resolve const expression using
relative operators ICE
   Product: gcc
   Version: 14.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: ---

For example, it appears to occur if a constant expression has a relop.  The
result of the relop is stored in a variable and is not resolved at compile
time.


$ gm2 -g -c BasicFileSys.mod
-I../../../../Sandpit/gm2-outside-tree-tests/build/source/m2pp/src/ 
terminate called after throwing an instance of 'unsigned int'
cc1gm2: internal compiler error: Aborted
0x178a0e3 crash_signal
../../gcc/toplev.cc:319
0x8f590990 __pthread_kill_implementation
./nptl/pthread_kill.c:44
0x8f54a76b __GI_raise
../sysdeps/posix/raise.c:26
0x8f5374bb __GI_abort
./stdlib/abort.c:79
0xf1a64f InvokeHandler
m2/gm2-libs-boot/RTExceptions.c:484
0xf1b1ff RTExceptions_Raise
m2/gm2-libs-boot/RTExceptions.c:946
0xf1ac33 invalidloc
m2/gm2-libs-boot/RTExceptions.c:755
0xf211a3 sigbusDespatcher
../../gcc/m2/gm2-libs-ch/SysExceptions.c:125
0x11fce74 fold(tree_node*)
../../gcc/fold-const.cc:13798
0xde8bd7 m2convert_BuildConvert
../../gcc/m2/gm2-gcc/m2convert.cc:439
0xdf1f33 m2expr_BuildIndirect
../../gcc/m2/gm2-gcc/m2expr.cc:3520
0xe5802b CodeXIndr
m2/gm2-compiler-boot/M2GenGCC.c:9350
0xe47cd3 CodeStatement
m2/gm2-compiler-boot/M2GenGCC.c:2062
0xe58177 M2GenGCC_ConvertQuadsToTree
m2/gm2-compiler-boot/M2GenGCC.c:9380
0xe939af M2Scope_ForeachScopeBlockDo2
m2/gm2-compiler-boot/M2Scope.c:675
0xe33783 M2Code_CodeBlock
m2/gm2-compiler-boot/M2Code.c:529
0xe33027 DoCodeBlock
m2/gm2-compiler-boot/M2Code.c:292
0xe336b3 M2Code_Code
m2/gm2-compiler-boot/M2Code.c:467
0xe33c53 Compile
m2/gm2-compiler-boot/M2Comp.c:469
0xe359a3 M2Comp_compile
m2/gm2-compiler-boot/M2Comp.c:1592


The variable used to contain the result of the relop constant expression can be
seen in:

MODULE constbool3 ;


CONST
   AddressableBits = 32 ;
   MaxBits = 16 ;

   BitsInUse = ORD(AddressableBits > MaxBits) * MaxBits + ORD(AddressableBits
<= MaxBits) * AddressableBits;

BEGIN

END constbool3.

$ gm2 -fiso constbool3.mod 
constbool3.mod:8:36: error: In program module 'constbool3': the procedure
function 'ORD' is being called from within a constant expression and therefore
the parameter must be a constant, seen a expression
8 |BitsInUse = ORD(AddressableBits > MaxBits) * MaxBits +
ORD(AddressableBits <= MaxBits) * AddressableBits;
  |^
constbool3.mod:8:79: error: the procedure function 'ORD' is being called from
within a constant expression and therefore the parameter must be a constant,
seen a expression
8 |BitsInUse = ORD(AddressableBits > MaxBits) * MaxBits +
ORD(AddressableBits <= MaxBits) * AddressableBits;
  |  
^~
constbool3.mod:8:14: error: in assignment, cannot assign a variable to a
constant 'BitsInUse'
8 |BitsInUse = ORD(AddressableBits > MaxBits) * MaxBits +
ORD(AddressableBits <= MaxBits) * AddressableBits;
  |   
~~^~
constbool3.mod:8:4: error: designator 'BitsInUse' is declared as a CONST
8 |BitsInUse = ORD(AddressableBits > MaxBits) * MaxBits +
ORD(AddressableBits <= MaxBits) * AddressableBits;
  |^

[Bug modula2/114565] progress trace would be useful to isolate ICE for users

2024-04-02 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114565

Gaius Mulley  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #6 from Gaius Mulley  ---
Closing.

[Bug modula2/114565] progress trace would be useful to isolate ICE for users

2024-04-02 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114565

--- Comment #5 from Gaius Mulley  ---
Closing now the patch has been bootstrapped, compared and applied.

[Bug modula2/114565] progress trace would be useful to isolate ICE for users

2024-04-02 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114565

Gaius Mulley  changed:

   What|Removed |Added

  Attachment #57851|0   |1
is obsolete||

--- Comment #3 from Gaius Mulley  ---
Created attachment 57852
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57852=edit
Proposed patch v3

Here is an improved patch which has been generated against the current tip of
the repository and also contains performance fixes for the token trace.

[Bug modula2/114565] progress trace would be useful to isolate ICE for users

2024-04-02 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114565

--- Comment #2 from Gaius Mulley  ---
Created attachment 57851
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57851=edit
Proposed patch

Here is a proposed patch which introduces the option -fm2-debug-trace=
and allows a comma separated list containing: quad,token,line,all.
It currently dumps progress to stdout and this would be expected to change once
PR113836 is complete.  In short the progress data should also be dumped to file
and flushed on every newline.

[Bug modula2/114565] progress trace would be useful to isolate ICE for users

2024-04-02 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114565

Gaius Mulley  changed:

   What|Removed |Added

   Last reconfirmed||2024-04-02
 Status|UNCONFIRMED |ASSIGNED
 Ever confirmed|0   |1

--- Comment #1 from Gaius Mulley  ---
Confirmed.

[Bug modula2/114565] New: progress trace would be useful to isolate ICE for users

2024-04-02 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114565

Bug ID: 114565
   Summary: progress trace would be useful to isolate ICE for
users
   Product: gcc
   Version: 14.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: ---

As suggested on the gm2 mailing list, it would be helpful if gm2 had an option
to dump progress to help users isolate source code which triggers an ICE.

[Bug modula2/114548] gm2 fails to identify variable in a const expression

2024-04-01 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114548

Gaius Mulley  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #5 from Gaius Mulley  ---
Closing now the patch has been applied.

[Bug modula2/114548] gm2 fails to identify variable in a const expression

2024-04-01 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114548

--- Comment #3 from Gaius Mulley  ---
Created attachment 57840
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57840=edit
Proposed fix

Here is a proposed patch (which fixes all the standard procedure function
const/var parameter checking):

$ gm2 -fiso testcmplx.mod 
testcmplx.mod:4:17: error: In program module ‘testcmplx’: the procedure
function ‘CMPLX’ is being called from within a constant expression and
therefore the parameter ‘r’ must be a constant, seen a variable
4 |foo = CMPLX (r, i) ;
  | ^
testcmplx.mod:4:20: error: the procedure function ‘CMPLX’ is being called from
within a constant expression and therefore the parameter ‘i’ must be a
constant, seen a variable
4 |foo = CMPLX (r, i) ;
  |^
testcmplx.mod:4:8: error: in assignment, cannot assign a variable to a constant
‘foo’
4 |foo = CMPLX (r, i) ;
  |^
testcmplx.mod:4:4: error: designator ‘foo’ is declared as a CONST
4 |foo = CMPLX (r, i) ;
  |^~~

[Bug modula2/114548] gm2 fails to identify variable in a const expression

2024-04-01 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114548

--- Comment #2 from Gaius Mulley  ---
This is true for many of the standard procedure functions.

[Bug modula2/114548] gm2 fails to identify variable in a const expression

2024-04-01 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114548

Gaius Mulley  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
 Ever confirmed|0   |1
   Last reconfirmed||2024-04-01

--- Comment #1 from Gaius Mulley  ---
Confirmed.

[Bug modula2/114548] New: gm2 fails to identify variable in a const expression

2024-04-01 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114548

Bug ID: 114548
   Summary: gm2 fails to identify variable in a const expression
   Product: gcc
   Version: 14.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: ---

As reported on the gm2 mailing list.

gm2 fails to identify the specific variable within a const expression.  It
gives an error for the whole expression rather than the sub expression in
error.
For example:

$ cat testcmplx.mod
MODULE testcmplx ;

CONST
   foo = CMPLX (r, i) ;

VAR
   r, i: REAL ;
BEGIN

END testcmplx.

$ gm2 -fiso testcmplx.mod 
testcmplx.mod:4:8: error: In program module ‘testcmplx’: in assignment, cannot
assign a variable to a constant ‘foo’
4 |foo = CMPLX (r, i) ;
  |^
testcmplx.mod:4:4: error: designator ‘foo’ is declared as a CONST
4 |foo = CMPLX (r, i) ;
  |^~~

it could identify r and i as variables.

[Bug modula2/114529] profiledbootstrap fails to build and m2 causes odr violations during build

2024-03-29 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114529

Gaius Mulley  changed:

   What|Removed |Added

 Ever confirmed|0   |1
 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2024-03-29

--- Comment #1 from Gaius Mulley  ---
Confirmed.

[Bug modula2/114529] New: profiledbootstrap fails to build and m2 causes odr violations during build

2024-03-29 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114529

Bug ID: 114529
   Summary: profiledbootstrap fails to build and m2 causes odr
violations during build
   Product: gcc
   Version: 14.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: ---

Many warnings are seen during compilation, starting with:

/var/tmp/portage/sys-devel/gcc-14.0.1_pre20240324-r1/work/gcc-14-20240324/gcc/m2/mc-boot/GDynamicStrings.cc:109:8:
error: type Werror=odr][]]
  109 | struct DynamicStrings_Contents_r {
  |^
/var/tmp/portage/sys-devel/gcc-14.0.1_pre20240324-r1/work/gcc-14-20240324/gcc/m2/mc-boot/Gdecl.cc:834:8:
note: a different type is defined in another translation unit
  834 | struct DynamicStrings_Contents_r {
  |^
/var/tmp/portage/sys-devel/gcc-14.0.1_pre20240324-r1/work/gcc-14-20240324/gcc/m2/mc-boot/GDynamicStrings.cc:110:55:
note: the first difference of corresponding definitions is field ‘buf’
  110 |DynamicStrings__T3 buf;
  |   ^
/var/tmp/portage/sys-devel/gcc-14.0.1_pre20240324-r1/work/gcc-14-20240324/gcc/m2/mc-boot/Gdecl.cc:835:55:
note: a field of same name but different type is defined in another translation
unit
  835 |DynamicStrings__T7 buf;
  |   ^

Resulting in:

make[3]: Leaving directory
'/var/tmp/portage/sys-devel/gcc-14.0.1_pre20240324-r1/work/build/gcc'
rm gfdl.pod gcc.pod gfortran.pod gcov-dump.pod gcov-tool.pod fsf-funding.pod
gpl.pod cpp.pod gcov.pod lto-dump.pod gccgo.pod gdc.pod
make[2]: *** [Makefile:4878: all-stageprofile-gcc] Error 2 shuffle=1047648447
make[1]: *** [Makefile:31142: stageprofile-bubble] Error 2 shuffle=1047648447
make: *** [Makefile:31396: profiledbootstrap] Error 2 shuffle=1047648447
 * ERROR: sys-devel/gcc-14.0.1_pre20240324-r1::gentoo failed (compile phase):
 *   emake failed

[Bug modula2/114520] Incorrect ordering of import/export statements cause confusing error messages

2024-03-28 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114520

Gaius Mulley  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #5 from Gaius Mulley  ---
Closing now that the fix has been applied.

[Bug modula2/114520] Incorrect ordering of import/export statements cause confusing error messages

2024-03-28 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114520

--- Comment #3 from Gaius Mulley  ---
The fix is not elegant, but it is accurate:

$ gm2 localmodule2.mod 
localmodule2.mod:13:3: error: In inner module ‘local’: an IMPORT statement must
preceed an EXPORT statement
   13 |   IMPORT mult2 ;
  |   ^~

[Bug modula2/114520] Incorrect ordering of import/export statements cause confusing error messages

2024-03-28 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114520

--- Comment #2 from Gaius Mulley  ---
Created attachment 57832
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57832=edit
Proposed fix

The error recovery causes misleading error messages to appear if an EXPORT
and IMPORT statement are in the wrong order.  This patch detects the
incorrect order and issues an error message and prevents error recovery.
The fix should be improved and made more general if another similar
case is required.

gcc/m2/ChangeLog:

* gm2-compiler/P0SyntaxCheck.bnf (DetectImport): New procedure.
(EnableImportCheck): New boolean.
(Expect): Call DetectImport.
(Export): Set EnableImportCheck TRUE before ';' and FALSE
afterwards.

[Bug modula2/114520] Incorrect ordering of import/export statements cause confusing error messages

2024-03-28 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114520

Gaius Mulley  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
 Ever confirmed|0   |1
   Last reconfirmed||2024-03-28

--- Comment #1 from Gaius Mulley  ---
Confirmed.

[Bug modula2/114520] New: Incorrect ordering of import/export statements cause confusing error messages

2024-03-28 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114520

Bug ID: 114520
   Summary: Incorrect ordering of import/export statements cause
confusing error messages
   Product: gcc
   Version: 14.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: ---

As reported on the gm2 mailing list:

$ cat localmodule2.mod
MODULE localmodule2 ;

FROM libc IMPORT printf ;

PROCEDURE mult2 (n: CARDINAL) : CARDINAL ;
BEGIN
   RETURN 2*n
END mult2 ;

MODULE local ;

  EXPORT mysqr ;
  IMPORT mult2 ;

  PROCEDURE mysqr (n: CARDINAL) : CARDINAL ;
  BEGIN
 RETURN mult2 (n) * mult2 (n)
  END mysqr ;

END local ;

VAR
   d: CARDINAL ;
BEGIN
   d := mysqr (3) ;
   printf ("sqr (3 * 2) = %d\n", d)
END localmodule2.


$ gm2 localmodule2.mod 
localmodule2.mod:13:10: warning: In inner module ‘local’: syntax warning, ‘END’
missing 
   13 |   IMPORT mult2 ;
  |  ^
localmodule2.mod:20:11: warning: In program module ‘localmodule2’: syntax
warning, ‘.’ missing 
   20 | END local ;
  |   ^
localmodule2.mod:1:8: error: module name at beginning ‘localmodule2’ does not
match the name at end ‘local’
1 | MODULE localmodule2 ;
  |^~~~
localmodule2.mod:10:8: error: In inner module ‘local’: module name at beginning
‘local’ does not match the name at end ‘mult2’
   10 | MODULE local ;
  |^
localmodule2.mod:13:3: error: syntax error, found ‘IMPORT’
   13 |   IMPORT mult2 ;
  |   ^~
localmodule2.mod:13:10: error: module name at end ‘mult2’ does not match the
name at beginning ‘local’
   13 |   IMPORT mult2 ;
  |  ^
localmodule2.mod:20:5: error: In program module ‘localmodule2’: module name at
end ‘local’ does not match the name at beginning ‘localmodule2’
   20 | END local ;
  | ^
localmodule2.mod:20:11: error: syntax error, found ‘;’
   20 | END local ;
  |   ^
localmodule2.mod:28:1: error: no scope active: compilation failed


The user level fix is to switch the IMPORT and EXPORT statement lines.
However the compiler should generate a more meaningful error message.

[Bug modula2/114517] gm2 does not allow comparion operator # in the first column

2024-03-28 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114517

Gaius Mulley  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #3 from Gaius Mulley  ---
Closing now that the patch has been applied.

[Bug modula2/114517] gm2 does not allow comparion operator # in the first column

2024-03-28 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114517

Gaius Mulley  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
 Ever confirmed|0   |1
   Last reconfirmed||2024-03-28

--- Comment #2 from Gaius Mulley  ---
Confirmed.

[Bug modula2/114517] New: gm2 does not allow comparion operator # in the first column

2024-03-28 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114517

Bug ID: 114517
   Summary: gm2 does not allow comparion operator # in the first
column
   Product: gcc
   Version: 14.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: ---

gm2 allows # cpp directives, but this conflicts with the # comparison operator
(in the unlikely event that # appears in an expression in the first column).
It would be more appropriate to:

   (i)   by default allow # in the first column to be interpreted as a cpp
 directive (given this is the most likely desired use).
   (ii)  allow users to supply -fno-cpp to turn off this default and cc1gm2
 should interpret '#' as a comparison operator.

[Bug modula2/114478] isnormal builtin unavailable from m2

2024-03-26 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114478

Gaius Mulley  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #3 from Gaius Mulley  ---
Closing now the patch has been applied.

[Bug modula2/114478] isnormal builtin unavailable from m2

2024-03-26 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114478

Gaius Mulley  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2024-03-26
 Ever confirmed|0   |1

--- Comment #1 from Gaius Mulley  ---
Confirmed and it appears that the comparison builtins are also unavailable.

[Bug modula2/114478] New: isnormal builtin unavailable from m2

2024-03-26 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114478

Bug ID: 114478
   Summary: isnormal builtin unavailable from m2
   Product: gcc
   Version: 14.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: ---

As reported in a document the isnormal builtin is currently unavailable for
modula2.

[Bug modula2/114444] An error in the FLOAT/TRUNC will cause ICE due to malformed error specifier

2024-03-23 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=11

Gaius Mulley  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #4 from Gaius Mulley  ---
Closing now the patch has been applied.

[Bug modula2/114444] An error in the FLOAT/TRUNC will cause ICE due to malformed error specifier

2024-03-23 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=11

--- Comment #2 from Gaius Mulley  ---
Created attachment 57789
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57789=edit
Proposed fix

This patch corrects two error format specifiers.

gcc/m2/ChangeLog:

* gm2-compiler/M2Quads.mod (BuildTruncFunction): Correct
error format specifier.
(BuildFloatFunction): Correct error format specifier.

[Bug modula2/114444] An error in the FLOAT/TRUNC will cause ICE due to malformed error specifier

2024-03-23 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=11

Gaius Mulley  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
 Ever confirmed|0   |1
   Last reconfirmed||2024-03-23

--- Comment #1 from Gaius Mulley  ---
Confirmed.

[Bug modula2/114444] New: An error in the FLOAT/TRUNC will cause ICE due to malformed error specifier

2024-03-23 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=11

Bug ID: 11
   Summary: An error in the FLOAT/TRUNC will cause ICE due to
malformed error specifier
   Product: gcc
   Version: 14.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: ---

When blackbox testing it appears that an error relating to either TRUNC or
FLOAT will cause an ICE.  Upon gdb stack back trace it shows a malformed error
format.

[Bug modula2/114443] missing quote causes ICE

2024-03-23 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114443

Gaius Mulley  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #3 from Gaius Mulley  ---
Closing now the patch has been applied.

[Bug modula2/114443] missing quote causes ICE

2024-03-23 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114443

--- Comment #1 from Gaius Mulley  ---
Created attachment 57788
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57788=edit
Proposed fix

This patch inserts a missing quotation at the end of a line
if required (after an appropiate error message is generated).

gcc/m2/ChangeLog:

* m2.flex: Call AddTokCharStar with a stringtok if
end of line is reached without a closing quote.

gcc/testsuite/ChangeLog:

* gm2/pim/fail/missingquote.mod: New test.

[Bug modula2/114443] missing quote causes ICE

2024-03-23 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114443

Gaius Mulley  changed:

   What|Removed |Added

   Last reconfirmed||2024-03-23
 Status|UNCONFIRMED |ASSIGNED
 Ever confirmed|0   |1

[Bug modula2/114443] New: missing quote causes ICE

2024-03-23 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114443

Bug ID: 114443
   Summary: missing quote causes ICE
   Product: gcc
   Version: 14.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: ---

A missing end of string quote causes an ICE, for example:

MODULE missingquote ;

CONST
   MyConst = 'foobar

BEGIN

END missingquote.

$ gm2 missingquote.mod 
missingquote.mod:4:   MyConst = 'foobar
missingquote.mod:4: ^^^
missingquote.mod:4:missing terminating quote, '
cc1gm2: internal compiler error: in libc_abort, at m2/mc-boot-ch/Glibc.c:161

[Bug modula2/114422] Attempting to declare a set of unknown type causes ICE

2024-03-21 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114422

Gaius Mulley  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #4 from Gaius Mulley  ---
Closing now that the patch has been applied.

[Bug modula2/114422] Attempting to declare a set of unknown type causes ICE

2024-03-21 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114422

--- Comment #2 from Gaius Mulley  ---
Created attachment 57761
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57761=edit
Proposed fix

Here is the proposed fix containing the escaped error message and three
regression tests.

[Bug modula2/114422] Attempting to declare a set of unknown type causes ICE

2024-03-21 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114422

Gaius Mulley  changed:

   What|Removed |Added

   Last reconfirmed||2024-03-21
 Status|UNCONFIRMED |ASSIGNED
 Ever confirmed|0   |1

--- Comment #1 from Gaius Mulley  ---
Confirmed and the bug is a malformed error message directive.

[Bug modula2/114422] New: Attempting to declare a set of unknown type causes ICE

2024-03-21 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114422

Bug ID: 114422
   Summary: Attempting to declare a set of unknown type causes ICE
   Product: gcc
   Version: 14.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: ---

The following program causes an ICE in cc1gm2:

MODULE badset3 ;

TYPE
   userset = SET OF CHAR ;
VAR
   set: userset ;
BEGIN
   set := unknown {}
END badset3.

[Bug modula2/114418] Missing import of TSIZE from system causes ICE

2024-03-21 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114418

Gaius Mulley  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #3 from Gaius Mulley  ---
Closing now that the patch has been applied.

[Bug modula2/114418] Missing import of TSIZE from system causes ICE

2024-03-21 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114418

Gaius Mulley  changed:

   What|Removed |Added

 Ever confirmed|0   |1
 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2024-03-21

--- Comment #1 from Gaius Mulley  ---
Confirmed.

[Bug modula2/114418] New: Missing import of TSIZE from system causes ICE

2024-03-21 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114418

Bug ID: 114418
   Summary: Missing import of TSIZE from system causes ICE
   Product: gcc
   Version: 14.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: ---

As reported on the mailing list.  gm2 will ICE if given:

MODULE missingtsize ;

CONST
   NoOfBytes = TSIZE (CARDINAL) ;

BEGIN

END missingtsize.

[Bug modula2/114380] Incorrect type specified in an error message

2024-03-18 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114380

Gaius Mulley  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #5 from Gaius Mulley  ---
Closing now that the patch has been applied.

[Bug modula2/114380] Incorrect type specified in an error message

2024-03-18 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114380

--- Comment #3 from Gaius Mulley  ---
$ gm2 tiny4.mod 
tiny4.mod:13:17: error: In program module ‘tiny4’: type incompatibility between
‘BITSET’ and ‘WORD’
   13 |b := func () - {6..31}
  | ^

[Bug modula2/114380] Incorrect type specified in an error message

2024-03-18 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114380

--- Comment #2 from Gaius Mulley  ---
Created attachment 57725
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57725=edit
Proposed fix



PR modula2/114380 Incorrect type specified in an error message

This patch corrects an error message relating to a variable of
a SET type. The bugfix is not to skip over set types (in
GetLowestType).

gcc/m2/ChangeLog:

* gm2-compiler/SymbolTable.mod (GetLowestType): Do not
skip over a set type, but return sym.

gcc/testsuite/ChangeLog:

* gm2/pim/fail/badset7.mod: New test.

[Bug modula2/114380] Incorrect type specified in an error message

2024-03-18 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114380

Gaius Mulley  changed:

   What|Removed |Added

   Last reconfirmed||2024-03-18
 Ever confirmed|0   |1
 Status|UNCONFIRMED |ASSIGNED

--- Comment #1 from Gaius Mulley  ---
Confirmed.

[Bug modula2/114380] New: Incorrect type specified in an error message

2024-03-18 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114380

Bug ID: 114380
   Summary: Incorrect type specified in an error message
   Product: gcc
   Version: 14.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: ---

The source code:

MODULE tiny4 ;

FROM SYSTEM IMPORT WORD ;

PROCEDURE func () : WORD ;
BEGIN
   RETURN WORD (0)
END func ;

VAR
   b: BITSET ;
BEGIN
   b := func () - {6..31}
END tiny4.

when compiled should complain about BITSET rather than CARDINAL.

$ gm2 tiny4.mod 
tiny4.mod:13:17: error: In program module 'tiny4': type incompatibility between
'CARDINAL' and 'WORD'
   13 |b := func () - {6..31}
  | ^

[Bug modula2/114296] ICE when attempting to create a constant set with a variable element

2024-03-17 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114296

Gaius Mulley  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #3 from Gaius Mulley  ---
Closing now that the patch has been applied.  The ICE was caused by assuming
that the set elements were constants.  The patch contains a check and also
improves the token accuracy of the set sub expression.

The test code above now causes the following correct error message:

$ gm2 tiny2.mod 
tiny2.mod:8:10: error: a constant set can only contain constant set elements,
‘x’ is not a constant
8 |ch := {7 .. x};
  |  ^~~~

[Bug modula2/114296] ICE when attempting to create a constant set with a variable element

2024-03-16 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114296

--- Comment #1 from Gaius Mulley  ---
Created attachment 57719
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57719=edit
Proposed fix

Here is the proposed fix.  It corrects the virtual token creation for the
aggregate constant and also corrects tokens for constructor components.

[Bug modula2/114294] expression causes ICE

2024-03-14 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114294

Gaius Mulley  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #4 from Gaius Mulley  ---
Closing now that the patch has been applied.

[Bug modula2/114294] expression causes ICE

2024-03-14 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114294

--- Comment #2 from Gaius Mulley  ---
Created attachment 57704
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57704=edit
Proposed fix

The proposed fix was to assign a type to the result constant created by HIGH.
The call to PutConst was missing.

[Bug modula2/114333] set type comparison against a cardinal should cause an error

2024-03-14 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114333

Gaius Mulley  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #4 from Gaius Mulley  ---
Closing now the patch has been applied.

[Bug modula2/114333] set type comparison against a cardinal should cause an error

2024-03-14 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114333

--- Comment #2 from Gaius Mulley  ---
Created attachment 57694
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57694=edit
Proposed fix

Here is a proposed fix.  The fixes were mainly made in M2Check.mod with a few
checking calls made in M2GenGCC.mod.  This patch fixes # and = comparisons a
later patch will include the remaining four comparison tests.

[Bug modula2/114333] set type comparison against a cardinal should cause an error

2024-03-14 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114333

Gaius Mulley  changed:

   What|Removed |Added

   Last reconfirmed||2024-03-14
 Ever confirmed|0   |1
 Status|UNCONFIRMED |ASSIGNED

--- Comment #1 from Gaius Mulley  ---
Confirmed.

[Bug modula2/114333] New: set type comparison against a cardinal should cause an error

2024-03-14 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114333

Bug ID: 114333
   Summary: set type comparison against a cardinal should cause an
error
   Product: gcc
   Version: 14.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: ---

gm2 incorrectly allows set types to be compared to ZTyped constants.  For
example the following code should generate an error at the IF expression.

MODULE badset2 ;

FROM libc IMPORT printf ;


PROCEDURE init ;
VAR
   s: SET OF [1..2] ;
BEGIN
   IF s = 10
   THEN
  printf ("failure\n")
   END
END init ;


BEGIN
   init
END badset2.

[Bug modula2/114295] incorrect error location if attempting to compile implementation module without a definition module

2024-03-11 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114295

Gaius Mulley  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #3 from Gaius Mulley  ---
Closing now the patch has been applied.

  1   2   3   4   5   6   >