gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: An ICE that does not generate a full report


From: Gaius Mulley
Subject: Re: An ICE that does not generate a full report
Date: Mon, 08 Apr 2024 15:02:46 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)

Alice Osako <alicetrillianosako@gmail.com> writes:

> Oh, and note that the constants in CardMath.mod are not used for their own 
> values as such, but rather (AFAICT) are used to compute the number of bits in 
> a
> CARDINAL on a given platform, and the maximum number of decimal digits it can 
> represent. The ones in Size.def are used to determine the bitwidth for the
> largest scalar supported by the compiler/system.
>
> Alice Osako:
>
>  Gaius Mulley:
>
>  I'm now seeing it compile:
>
> $ 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
>
>  Thank you!
>
>  However, when I try to compile it, I get the following error:
>
>  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>  gm2 -g -fiso -freport-bug -fdebug-function-line-numbers -fsources -Isrc/ -c 
> src/imp/BasicFileSys.mod \
>  -o obj/BasicFileSys.o
>  Compiling: src/imp/BasicFileSys.mod
>  Pass 0: lexical analysis, parsing, modules and associated filenames
>     Module SYSTEM               : 
> /home/schol-r-lea/opt/lib/gcc/x86_64-pc-linux-gnu/14.0.1/m2/m2iso/SYSTEM.def 
> [m2iso]
>     Module M2RTS                : 
> /home/schol-r-lea/opt/lib/gcc/x86_64-pc-linux-gnu/14.0.1/m2/m2iso/M2RTS.def 
> [m2iso]
>     Module RTExceptions         : 
> /home/schol-r-lea/opt/lib/gcc/x86_64-pc-linux-gnu/14.0.1/m2/m2pim/RTExceptions.def
>  [m2pim]
>     Module BasicFileSys         : src/BasicFileSys.def
>     Module BasicFileSys         : src/imp/BasicFileSys.mod
>     Module Size                 : src/Size.def
>     Module stat                 : src/stat.def
>     Module stdio                : src/stdio.def (for C)
>     Module unistd               : src/unistd.def (for C)
>     Module fcntl                : src/fcntl.def (for C)
>     Module stat0                : src/stat0.def (for C)
>     Module SysTypes             : src/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
>  cc1gm2: error: In definition module ‘BasicFileSys’: constant ‘BW8’ should 
> not be reassigned
>  cc1gm2: error: constant ‘BW128’ should not be reassigned
>  cc1gm2: error: constant ‘BW120’ should not be reassigned
>  cc1gm2: error: constant ‘BW112’ should not be reassigned
>  cc1gm2: error: constant ‘BW104’ should not be reassigned
>  cc1gm2: error: constant ‘BW96’ should not be reassigned
>  cc1gm2: error: constant ‘BW88’ should not be reassigned
>  cc1gm2: error: constant ‘BW80’ should not be reassigned
>  cc1gm2: error: constant ‘BW72’ should not be reassigned
>  cc1gm2: error: constant ‘BW64’ should not be reassigned
>  cc1gm2: error: constant ‘BW56’ should not be reassigned
>  cc1gm2: error: constant ‘BW48’ should not be reassigned
>  cc1gm2: error: constant ‘BW40’ should not be reassigned
>  cc1gm2: error: constant ‘BW32’ should not be reassigned
>  cc1gm2: error: constant ‘BW24’ should not be reassigned
>  cc1gm2: error: constant ‘BW16’ should not be reassigned
>  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>  The constants in question are all defined in Size.def, and are not redefined 
> or even imported in either BasicFileSys.def or BasicFileSys.mod; however,
>  they are defined slightly differently in CardMath.mod, which also gives the 
> same error even though it doesn't import Size.def. 
>
>  I checked that the -fiso option was not the deciding factor in this, and it 
> wasn't. I'm not sure why it is behaving differently on my system.

it sounds like an older version of the compiler is being picked up:

$ gm2 --version
gm2 (GCC) 14.0.1 20240408 (experimental)
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

source/m2pp$ gm2 -g -fiso -freport-bug -fsources -Isrc/ -c 
src/imp/BasicFileSys.mod 
Compiling: src/imp/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/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 BasicFileSys         : src/BasicFileSys.def
   Module BasicFileSys         : src/imp/BasicFileSys.mod
   Module Size                 : src/Size.def
   Module stat                 : src/stat.def
   Module stdio                : src/stdio.def (for C)
   Module unistd               : src/unistd.def (for C)
   Module fcntl                : src/fcntl.def (for C)
   Module stat0                : src/stat0.def (for C)
   Module SysTypes             : src/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

the BW?? constants are all present in the Size.def

$ cat m2pp/src/Size.def 
(*!m2pim*) (* Copyright (c) 2017 Modula-2 Software Foundation *)

DEFINITION MODULE Size; (* LONGINT version *)

(* Whole number type with largest positive value *)


(* Identifiers provided for client use:
     Size, SizeT, Bitwidth, BitsInUse, AddressableBits. *)

TYPE Size = LONGINT [0..MAX(LONGINT)];

TYPE SizeT = Size; (* alias for unqualified use *)


(* ---------------------------------------------------------------------------
 * compile time calculation of the bit width of type Size
 * ------------------------------------------------------------------------ *)

CONST
  MaxSizeDivPow2Of8   = MAX(Size) DIV 256;
  MaxSizeDivPow2Of16  = MaxSizeDivPow2Of8 DIV 256;
  MaxSizeDivPow2Of24  = MaxSizeDivPow2Of16 DIV 256;
  MaxSizeDivPow2Of32  = MaxSizeDivPow2Of24 DIV 256;
  MaxSizeDivPow2Of40  = MaxSizeDivPow2Of32 DIV 256;
  MaxSizeDivPow2Of48  = MaxSizeDivPow2Of40 DIV 256;
  MaxSizeDivPow2Of56  = MaxSizeDivPow2Of48 DIV 256;
  MaxSizeDivPow2Of64  = MaxSizeDivPow2Of56 DIV 256;
  MaxSizeDivPow2Of72  = MaxSizeDivPow2Of64 DIV 256;
  MaxSizeDivPow2Of80  = MaxSizeDivPow2Of72 DIV 256;
  MaxSizeDivPow2Of88  = MaxSizeDivPow2Of80 DIV 256;
  MaxSizeDivPow2Of96  = MaxSizeDivPow2Of88 DIV 256;
  MaxSizeDivPow2Of104 = MaxSizeDivPow2Of96 DIV 256;
  MaxSizeDivPow2Of112 = MaxSizeDivPow2Of104 DIV 256;
  MaxSizeDivPow2Of120 = MaxSizeDivPow2Of112 DIV 256;
  
  BW8   = (MAX(Size) <= 127);
  BW16  = (MaxSizeDivPow2Of8 > 0) AND (MaxSizeDivPow2Of8 <= 127);
  BW24  = (MaxSizeDivPow2Of16 > 0) AND (MaxSizeDivPow2Of16 <= 127);
  BW32  = (MaxSizeDivPow2Of24 > 0) AND (MaxSizeDivPow2Of24 <= 127);
  BW40  = (MaxSizeDivPow2Of32 > 0) AND (MaxSizeDivPow2Of32 <= 127);
  BW48  = (MaxSizeDivPow2Of40 > 0) AND (MaxSizeDivPow2Of40 <= 127);
  BW56  = (MaxSizeDivPow2Of48 > 0) AND (MaxSizeDivPow2Of48 <= 127);
  BW64  = (MaxSizeDivPow2Of56 > 0) AND (MaxSizeDivPow2Of56 <= 127);
  BW72  = (MaxSizeDivPow2Of64 > 0) AND (MaxSizeDivPow2Of64 <= 127);
  BW80  = (MaxSizeDivPow2Of72 > 0) AND (MaxSizeDivPow2Of72 <= 127);
  BW88  = (MaxSizeDivPow2Of80 > 0) AND (MaxSizeDivPow2Of80 <= 127);
  BW96  = (MaxSizeDivPow2Of88 > 0) AND (MaxSizeDivPow2Of88 <= 127);
  BW104 = (MaxSizeDivPow2Of96 > 0) AND (MaxSizeDivPow2Of96 <= 127);
  BW112 = (MaxSizeDivPow2Of104 > 0) AND (MaxSizeDivPow2Of104 <= 127);
  BW120 = (MaxSizeDivPow2Of112 > 0) AND (MaxSizeDivPow2Of112 <= 127);
  BW128 = (MaxSizeDivPow2Of120 > 0) AND (MaxSizeDivPow2Of120 <= 127);
  
  Bitwidth = (* storage size *)
    8*ORD(BW8) + 16*ORD(BW16) + 24*ORD(BW24) + 32*ORD(BW32) +
    40*ORD(BW40) + 48*ORD(BW48) + 56*ORD(BW56) + 64*ORD(BW64) +
    72*ORD(BW72) + 80*ORD(BW80) + 88*ORD(BW88) + 96*ORD(BW96) +
    104*ORD(BW104) + 112*ORD(BW112) + 120*ORD(BW120) + 128*ORD(BW128);
  
  BitsInUse = Bitwidth - 1; (* apparent size *)
  
  AddressableBits = Bitwidth - 1; (* addressable size *)
  
  
END Size.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]