* [committed] modula2: Fix lto profiledbootstrap on powerpc64le-linux and s390x-linux [PR108153]
@ 2022-12-21 8:21 Jakub Jelinek
2022-12-21 12:41 ` Gaius Mulley
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2022-12-21 8:21 UTC (permalink / raw)
To: Gaius Mulley; +Cc: gcc-patches
Hi!
Lto profiledbootstrap was failing for me on {powerpc64le,s390x}-linux with
modula 2 enabled, with:
cc1gm2: internal compiler error: the location value is corrupt
0x11a3d2d m2assert_AssertLocation(unsigned int)
../../gcc/m2/gm2-gcc/m2assert.cc:40
0x11a3d2d m2statement_BuildAssignmentTree
../../gcc/m2/gm2-gcc/m2statement.cc:177
ICE. The problem was that caller (m2assert_AssertLocation used
location_t M2Options_OverrideLocation (location_t);
prototype with the libcpp/line-map.h
typedef unsigned int location_t;
typedef, but the callee defined in Modula 2 was using:
TYPE
location_t = INTEGER ;
and
PROCEDURE OverrideLocation (location: location_t) : location_t ;
Now, on powerpc64le-linux unsigned int is returned and passed zero extended
into 64-bits, while signed int is returned and passed sign-extended into 64-bits
and Modula 2 INTEGER is signed 32-bit type, so when the caller then compared
M2Options_OverrideLocation (location) != location
and powerpc64le-linux performed the comparison as 64-bit compare, there
was a mismatch for location_t of 0x8000007 or others with the MSB set.
Fixed by making Modula 2 location_t a CARDINAL, which is 32-bit unsigned type.
Bootstrapped/regtested normally on x86_64-linux and i686-linux, with
bootstrap-lto profiledbootstrap on powerpc64le-linux and aarch64-linux so
far (and in regtesting on x86_64-linux, i686-linux and s390x-linux),
approved in the PR by Gaius, committed to trunk.
2022-12-21 Jakub Jelinek <jakub@redhat.com>
PR modula2/108153
* gm2-gcc/m2linemap.def (location_t): Use CARDINAL instead of INTEGER.
--- gcc/m2/gm2-gcc/m2linemap.def.jj 2022-12-19 14:59:50.169762747 +0100
+++ gcc/m2/gm2-gcc/m2linemap.def 2022-12-20 16:36:18.321555969 +0100
@@ -30,7 +30,7 @@ EXPORT QUALIFIED StartFile, EndFile, Sta
WarningAtf, NoteAtf, internal_error, location_t ;
TYPE
- location_t = INTEGER ;
+ location_t = CARDINAL ;
PROCEDURE StartFile (filename: ADDRESS; linebegin: CARDINAL) ;
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [committed] modula2: Fix lto profiledbootstrap on powerpc64le-linux and s390x-linux [PR108153]
2022-12-21 8:21 [committed] modula2: Fix lto profiledbootstrap on powerpc64le-linux and s390x-linux [PR108153] Jakub Jelinek
@ 2022-12-21 12:41 ` Gaius Mulley
0 siblings, 0 replies; 2+ messages in thread
From: Gaius Mulley @ 2022-12-21 12:41 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: gcc-patches
Jakub Jelinek <jakub@redhat.com> writes:
> Hi!
>
> Lto profiledbootstrap was failing for me on {powerpc64le,s390x}-linux with
> modula 2 enabled, with:
> cc1gm2: internal compiler error: the location value is corrupt
> 0x11a3d2d m2assert_AssertLocation(unsigned int)
> ../../gcc/m2/gm2-gcc/m2assert.cc:40
> 0x11a3d2d m2statement_BuildAssignmentTree
> ../../gcc/m2/gm2-gcc/m2statement.cc:177
> ICE. The problem was that caller (m2assert_AssertLocation used
> location_t M2Options_OverrideLocation (location_t);
> prototype with the libcpp/line-map.h
> typedef unsigned int location_t;
> typedef, but the callee defined in Modula 2 was using:
> TYPE
> location_t = INTEGER ;
> and
> PROCEDURE OverrideLocation (location: location_t) : location_t ;
> Now, on powerpc64le-linux unsigned int is returned and passed zero extended
> into 64-bits, while signed int is returned and passed sign-extended into 64-bits
> and Modula 2 INTEGER is signed 32-bit type, so when the caller then compared
> M2Options_OverrideLocation (location) != location
> and powerpc64le-linux performed the comparison as 64-bit compare, there
> was a mismatch for location_t of 0x8000007 or others with the MSB set.
>
> Fixed by making Modula 2 location_t a CARDINAL, which is 32-bit unsigned type.
>
> Bootstrapped/regtested normally on x86_64-linux and i686-linux, with
> bootstrap-lto profiledbootstrap on powerpc64le-linux and aarch64-linux so
> far (and in regtesting on x86_64-linux, i686-linux and s390x-linux),
> approved in the PR by Gaius, committed to trunk.
>
> 2022-12-21 Jakub Jelinek <jakub@redhat.com>
>
> PR modula2/108153
> * gm2-gcc/m2linemap.def (location_t): Use CARDINAL instead of INTEGER.
>
> --- gcc/m2/gm2-gcc/m2linemap.def.jj 2022-12-19 14:59:50.169762747 +0100
> +++ gcc/m2/gm2-gcc/m2linemap.def 2022-12-20 16:36:18.321555969 +0100
> @@ -30,7 +30,7 @@ EXPORT QUALIFIED StartFile, EndFile, Sta
> WarningAtf, NoteAtf, internal_error, location_t ;
>
> TYPE
> - location_t = INTEGER ;
> + location_t = CARDINAL ;
>
>
> PROCEDURE StartFile (filename: ADDRESS; linebegin: CARDINAL) ;
>
> Jakub
Hi Jakub,
thanks for finding the bug and the fix!
regards,
Gaius
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-12-21 12:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-21 8:21 [committed] modula2: Fix lto profiledbootstrap on powerpc64le-linux and s390x-linux [PR108153] Jakub Jelinek
2022-12-21 12:41 ` Gaius Mulley
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).