[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Portability Considerations
From: |
Gaius Mulley |
Subject: |
Re: Portability Considerations |
Date: |
Thu, 21 Mar 2024 17:16:21 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) |
Alice Osako <alicetrillianosako@gmail.com> writes:
> I ended up entirely deleting and replacing the local git repo, and
> that solved the problem with building gm2 v.14.0.1 (this was built off
> of the master trunk, so I don't know if there is a branch with the
> aforementioned 14.2 version).
>
> I have tried compiling the code for the program ('make portable') with
> the resulting compiler, but still got an ICE. I am seriously wondering
> if there is something wrong with my setup.
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> // Target: x86_64-pc-linux-gnu
> // Configured with: /home/schol-r-lea/Deployments/gm2/gcc/configure
> --host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu
> --prefix=/home/schol-r-lea/opt --bindir=/home/schol-r-lea/opt/bin
> --libdir=/home/schol-r-lea/opt/lib
> --libexecdir=/home/schol-r-lea/opt/lib --enable-threads=posix
> --enable-clocale=gnu --disable-multilib --disable-bootstrap
> --enable-checking --enable-languages=m2
> // Thread model: posix
> // Supported LTO compression algorithms: zlib zstd
> // gcc version 14.0.1 20240321 (experimental) (GCC)
> //
> // -quiet: internal compiler error: illegal symbol
> // 0x22a6c27 internal_error(char const*, ...)
> // ???:0
> // 0x967432 m2linemap_internal_error
> // ???:0
> // 0xa3534b M2Emit_InternalError
> // ???:0
> // 0x9930ae M2Error_InternalError
> // ???:0
> // 0x9f2c5a SymbolTable_IsProcedure
> // ???:0
> // 0x9e6ed9 PCSymBuild_PushConstFunctionType
> // ???:0
> // 0xa22723 PCBuild_CompilationUnit
> // ???:0
> // 0x9904ae M2Comp_compile
> // ???:0
> // Please submit a full bug report, with preprocessed source.
> // Please include the complete backtrace with any bug report.
> // See <https://gcc.gnu.org/bugs/> for instructions.
>
> // /home/schol-r-lea/opt/lib/gcc/x86_64-pc-linux-gnu/14.0.1/cc1gm2
> -quiet -dumpdir objs/ -dumpbase CardBitOps.mod -dumpbase-ext .mod
> -mtune=generic -march=x86-64 -g -freport-bug -fm2-pathname=-
> -fm2-pathnameIdefs/ -fm2-pathnameI. -fscaffold-dynamic
> -flibs=m2cor,m2log,m2pim,m2iso -fm2-pathname=- -fm2-pathnameIdefs/
> -fm2-pathnameI. impls/portable/CardBitOps.mod -c -o - -frandom-seed=0
> -fdump-noaddr
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> I realize it is something of a big request, but could someone please
> see if they can get this to compile on their system?
>
> https://github.com/Schol-R-LEA/Modula-2-Portable-Bit-Manipulation/tree/main
Hi Alice,
ah yes thanks - indeed a bug. Here is a proposed fix:
diff --git a/gcc/m2/gm2-compiler/PCSymBuild.mod
b/gcc/m2/gm2-compiler/PCSymBuild.mod
index e2165408781..5535730238f 100644
--- a/gcc/m2/gm2-compiler/PCSymBuild.mod
+++ b/gcc/m2/gm2-compiler/PCSymBuild.mod
@@ -1412,6 +1412,37 @@ BEGIN
END buildConstFunction ;
+(*
+ ErrorConstFunction -
+*)
+
+PROCEDURE ErrorConstFunction (func: CARDINAL; functok: CARDINAL) ;
+BEGIN
+ IF func = NulSym
+ THEN
+ IF Iso
+ THEN
+ ErrorFormat0 (NewError (functok),
+ 'the only functions permissible in a constant
expression are: CAP, CHR, CMPLX, FLOAT, HIGH, IM, LENGTH, MAX, MIN, ODD, ORD,
RE, SIZE, TSIZE, TRUNC, VAL and gcc builtins')
+ ELSE
+ ErrorFormat0 (NewError (functok),
+ 'the only functions permissible in a constant
expression are: CAP, CHR, FLOAT, HIGH, MAX, MIN, ODD, ORD, SIZE, TSIZE, TRUNC,
VAL and gcc builtins')
+ END
+ ELSE
+ IF Iso
+ THEN
+ MetaErrorT1 (functok,
+ 'the only functions permissible in a constant expression
are: CAP, CHR, CMPLX, FLOAT, HIGH, IM, LENGTH, MAX, MIN, ODD, ORD, RE, SIZE,
TSIZE, TRUNC, VAL and gcc builtins, but not {%1Ead}',
+ func)
+ ELSE
+ MetaErrorT1 (functok,
+ 'the only functions permissible in a constant expression
are: CAP, CHR, FLOAT, HIGH, MAX, MIN, ODD, ORD, SIZE, TSIZE, TRUNC, VAL and gcc
builtins, but not {%1Ead}',
+ func)
+ END
+ END
+END ErrorConstFunction ;
+
+
(*
PushConstFunctionType -
*)
@@ -1426,7 +1457,10 @@ BEGIN
PopTtok (func, functok) ;
IF inDesignator
THEN
- IF (func#Convert) AND
+ IF func = NulSym
+ THEN
+ ErrorConstFunction (func, functok)
+ ELSIF (func#Convert) AND
(IsPseudoBaseFunction(func) OR
IsPseudoSystemFunctionConstExpression(func) OR
(IsProcedure(func) AND IsProcedureBuiltin(func)))
@@ -1442,16 +1476,7 @@ BEGIN
WriteFormat0('a constant type conversion can only have one
argument')
END
ELSE
- IF Iso
- THEN
- MetaErrorT1 (functok,
- 'the only functions permissible in a constant
expression are: CAP, CHR, CMPLX, FLOAT, HIGH, IM, LENGTH, MAX, MIN, ODD, ORD,
RE, SIZE, TSIZE, TRUNC, VAL and gcc builtins, but not {%1Ead}',
- func)
- ELSE
- MetaErrorT1 (functok,
- 'the only functions permissible in a constant
expression are: CAP, CHR, FLOAT, HIGH, MAX, MIN, ODD, ORD, SIZE, TSIZE, TRUNC,
VAL and gcc builtins, but not {%1Ead}',
- func)
- END
+ ErrorConstFunction (func, functok)
END
END ;
PushTtok (func, functok)
which I'll git commit/push once the bootstrap regressions all pass
(in about 50 mins time).
In the meanwhile it can be avoided with this patch:
git diff -w
diff --git a/impls/portable/CardBitOps.mod b/impls/portable/CardBitOps.mod
index db7a297..3db9d8b 100644
--- a/impls/portable/CardBitOps.mod
+++ b/impls/portable/CardBitOps.mod
@@ -18,6 +18,7 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. *)
IMPLEMENTATION MODULE CardBitOps; (* portable *)
(* Bit Operations on Type CARDINAL *)
+FROM SYSTEM IMPORT TSIZE ;
(* ---------------------------------------------------------------------------
* function shl( n, shiftFactor )
many thanks for reporting the compiler bug,
regards,
Gaius
- Re: Portability Considerations, (continued)
- Re: Portability Considerations, Alice Osako, 2024/03/18
- Portable bitwise operations library (was Re: Portability Considerations), Alice Osako, 2024/03/18
- Re: Portable bitwise operations library (was Re: Portability Considerations), Benjamin Kowarsch, 2024/03/20
- Re: Portable bitwise operations library (was Re: Portability Considerations), Alice Osako, 2024/03/20
- Re: Portable bitwise operations library (was Re: Portability Considerations), Benjamin Kowarsch, 2024/03/20
- Another ICE (was Re: Portable bitwise operations library), Alice Osako, 2024/03/20
- Re: Another ICE (was Re: Portable bitwise operations library), john o goyo, 2024/03/20
- Re: Portability Considerations, Alice Osako, 2024/03/20
- Re: Portability Considerations, Gaius Mulley, 2024/03/21
- Re: Portability Considerations, Alice Osako, 2024/03/21
- Re: Portability Considerations,
Gaius Mulley <=
- Re: Portability Considerations, Alice Osako, 2024/03/21
- Re: Portability Considerations, Gaius Mulley, 2024/03/21
- Re: Portability Considerations, Rudolf Schubert, 2024/03/21
- Re: Portable bitwise operations library (was Re: Portability Considerations), Gaius Mulley, 2024/03/22
- Re: Portable bitwise operations library (was Re: Portability Considerations), Alice Osako, 2024/03/21
- Re: Portable bitwise operations library (was Re: Portability Considerations), john o goyo, 2024/03/22
- Re: Portable bitwise operations library (was Re: Portability Considerations), Alice Osako, 2024/03/22
- Re: Portable bitwise operations library (was Re: Portability Considerations), john o goyo, 2024/03/22
- Re: Portable bitwise operations library (was Re: Portability Considerations), Alice Osako, 2024/03/22
- Re: Portable bitwise operations library (was Re: Portability Considerations), john o goyo, 2024/03/23