public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug modula2/108956] New: [13 regression] SEGV in M2RTS_RegisterModule
@ 2023-02-27 21:26 ro at gcc dot gnu.org
  2023-02-27 21:27 ` [Bug modula2/108956] " ro at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: ro at gcc dot gnu.org @ 2023-02-27 21:26 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108956
           Summary: [13 regression] SEGV in M2RTS_RegisterModule
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: modula2
          Assignee: gaius at gcc dot gnu.org
          Reporter: ro at gcc dot gnu.org
  Target Milestone: ---
              Host: sparc-sun-solaris2.11
            Target: sparc-sun-solaris2.11
             Build: sparc-sun-solaris2.11

Between 20230224 (0ccfa3884f638816af0f5a3f0ee2695e0771ef6d) and 20230227
(dfa85beebfbc2f879d30d3918f634feabc851782),
32-bit Solaris/SPARC bootstrap failed in stage 2:

m2/pge -k -l /vol/gcc/src/hg/master/local/gcc/m2/gm2-compiler/P2Build.bnf -o
m2/gm2-compiler-boot/P2Build.mod
make[3]: *** [/vol/gcc/src/hg/master/local/gcc/m2/Make-lang.in:1629:
m2/gm2-compiler-boot/P2Build.mod] Segmentation Fault

P3Build.mod is likewise affected.

gdb shows

Thread 2 received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1 (LWP 1)]
0x00034d24 in M2RTS_RegisterModule (name=0x25c98, 
    libname=0x4dd24 <_M2_UnixArgs_init(int, char**, char**)>, init=..., 
    fini=..., dependencies=...)
    at /vol/gcc/src/hg/master/local/gcc/m2/pge-boot/GM2RTS.c:464
464     {
1: x/i $pc
=> 0x34d24 <M2RTS_RegisterModule(void*, void*, M2RTS_ArgCVEnvP,
M2RTS_ArgCVEnvP, PROC)+40>:     ld  [ %i5 ], %g1
(gdb) p/x $i5
$1 = 0x2944
(gdb) bt
#0  0x00034d24 in M2RTS_RegisterModule (name=0x25c98, 
    libname=0x4dd24 <_M2_UnixArgs_init(int, char**, char**)>, init=..., 
    fini=..., dependencies=...)
    at /vol/gcc/src/hg/master/local/gcc/m2/pge-boot/GM2RTS.c:464
#1  0x0004ddcc in _M2_UnixArgs_ctor::_M2_UnixArgs_ctor (
    this=0x83958 <_M2_UnixArgs_ctor>)
    at /vol/gcc/src/hg/master/local/gcc/m2/pge-boot/GUnixArgs.cc:89
#2  0x0004ddec in __static_initialization_and_destruction_0 ()
    at /vol/gcc/src/hg/master/local/gcc/m2/pge-boot/GUnixArgs.cc:85
#3  0x0004de04 in _GLOBAL__sub_I_UnixArgs_GetArgC ()
    at /vol/gcc/src/hg/master/local/gcc/m2/pge-boot/GUnixArgs.cc:91
#4  0xff1b2b48 in call_array () from /usr/lib/ld.so.1
#5  0xff1b2cd8 in call_init () from /usr/lib/ld.so.1
#6  0xff1b1fb4 in setup () from /usr/lib/ld.so.1
#7  0xff1c42ec in _setup () from /usr/lib/ld.so.1
#8  0xff1a44c0 in _rt_boot () from /usr/lib/ld.so.1

Address 0x2944 isn't mapped, thus the SEGV.

Apparently this is a caller/callee mismatch:

#0  0x00034d24 in M2RTS_RegisterModule (name=0x25c98, 
    libname=0x4dd24 <_M2_UnixArgs_init(int, char**, char**)>, init=..., 
    fini=..., dependencies=...)
    at /vol/gcc/src/hg/master/local/gcc/m2/pge-boot/GM2RTS.c:464
464     {
(gdb) p dependencies
$4 = {proc = 0x0}
(gdb) up
#1  0x0004ddcc in _M2_UnixArgs_ctor::_M2_UnixArgs_ctor (
    this=0x83958 <_M2_UnixArgs_ctor>)
    at /vol/gcc/src/hg/master/local/gcc/m2/pge-boot/GUnixArgs.cc:89
89        M2RTS_RegisterModule ("UnixArgs", _M2_UnixArgs_init,
_M2_UnixArgs_fini,
(gdb) p _M2_UnixArgs_dep
$3 = {void (void)} 0x4dd8c <_M2_UnixArgs_dep()>

dependencies is of type PROC (i.e.struct { PROC_t proc; }) while
_M2_UnixArgs_dep is extern "C" void _M2_UnixArgs_dep (void).

This is almost certainly caused by

commit 05652ac4e8b8685fe0c0f4ee2f75516d28bbf892
Author: Gaius Mulley <gaiusmod2@gmail.com>
Date:   Sat Feb 25 16:28:19 2023 +0000

    modula-2 module registration process seems to fail with shared libraries
[PR
108261]

64-bit Solaris/SPARC (sparcv9-sun-solaris2.11) isn't affected.

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

* [Bug modula2/108956] [13 regression] SEGV in M2RTS_RegisterModule
  2023-02-27 21:26 [Bug modula2/108956] New: [13 regression] SEGV in M2RTS_RegisterModule ro at gcc dot gnu.org
@ 2023-02-27 21:27 ` ro at gcc dot gnu.org
  2023-02-28  1:15 ` gaius at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: ro at gcc dot gnu.org @ 2023-02-27 21:27 UTC (permalink / raw)
  To: gcc-bugs

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

Rainer Orth <ro at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |13.0

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

* [Bug modula2/108956] [13 regression] SEGV in M2RTS_RegisterModule
  2023-02-27 21:26 [Bug modula2/108956] New: [13 regression] SEGV in M2RTS_RegisterModule ro at gcc dot gnu.org
  2023-02-27 21:27 ` [Bug modula2/108956] " ro at gcc dot gnu.org
@ 2023-02-28  1:15 ` gaius at gcc dot gnu.org
  2023-02-28  1:16 ` gaius at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: gaius at gcc dot gnu.org @ 2023-02-28  1:15 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gaius at gcc dot gnu.org

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

Thanks for the bug report - here is a proposed fix.

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

* [Bug modula2/108956] [13 regression] SEGV in M2RTS_RegisterModule
  2023-02-27 21:26 [Bug modula2/108956] New: [13 regression] SEGV in M2RTS_RegisterModule ro at gcc dot gnu.org
  2023-02-27 21:27 ` [Bug modula2/108956] " ro at gcc dot gnu.org
  2023-02-28  1:15 ` gaius at gcc dot gnu.org
@ 2023-02-28  1:16 ` gaius at gcc dot gnu.org
  2023-02-28  1:29 ` gaius at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: gaius at gcc dot gnu.org @ 2023-02-28  1:16 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-02-28
             Status|UNCONFIRMED                 |ASSIGNED

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

* [Bug modula2/108956] [13 regression] SEGV in M2RTS_RegisterModule
  2023-02-27 21:26 [Bug modula2/108956] New: [13 regression] SEGV in M2RTS_RegisterModule ro at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-02-28  1:16 ` gaius at gcc dot gnu.org
@ 2023-02-28  1:29 ` gaius at gcc dot gnu.org
  2023-02-28  8:36 ` ro at CeBiTec dot Uni-Bielefeld.DE
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: gaius at gcc dot gnu.org @ 2023-02-28  1:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Gaius Mulley <gaius at gcc dot gnu.org> ---
The hand built modules were not changed to include the libname.  (UnixArgs,
ldtoa, dtoa for the tool pge).  The patch corrects the hand built modules and
also includes fixes for the attribute noreturn warnings generated when
compiling M2RTS.cc.

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

* [Bug modula2/108956] [13 regression] SEGV in M2RTS_RegisterModule
  2023-02-27 21:26 [Bug modula2/108956] New: [13 regression] SEGV in M2RTS_RegisterModule ro at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-02-28  1:29 ` gaius at gcc dot gnu.org
@ 2023-02-28  8:36 ` ro at CeBiTec dot Uni-Bielefeld.DE
  2023-02-28 13:02 ` gaius at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: ro at CeBiTec dot Uni-Bielefeld.DE @ 2023-02-28  8:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot Uni-Bielefeld.DE> ---
> --- Comment #2 from Gaius Mulley <gaius at gcc dot gnu.org> ---
> The hand built modules were not changed to include the libname.  (UnixArgs,
> ldtoa, dtoa for the tool pge).  The patch corrects the hand built modules and
> also includes fixes for the attribute noreturn warnings generated when
> compiling M2RTS.cc.

Unfortunately, this didn't help: the SEGV and caller/callee mismatch
remain exactly the same.

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

* [Bug modula2/108956] [13 regression] SEGV in M2RTS_RegisterModule
  2023-02-27 21:26 [Bug modula2/108956] New: [13 regression] SEGV in M2RTS_RegisterModule ro at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2023-02-28  8:36 ` ro at CeBiTec dot Uni-Bielefeld.DE
@ 2023-02-28 13:02 ` gaius at gcc dot gnu.org
  2023-02-28 15:36 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: gaius at gcc dot gnu.org @ 2023-02-28 13:02 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #54553|0                           |1
        is obsolete|                            |

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

Apologies - I mischecked the wrong UnixArgs.c.  Here is version 3 with the pge
UnixArgs.c changed to include the library name.

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

* [Bug modula2/108956] [13 regression] SEGV in M2RTS_RegisterModule
  2023-02-27 21:26 [Bug modula2/108956] New: [13 regression] SEGV in M2RTS_RegisterModule ro at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2023-02-28 13:02 ` gaius at gcc dot gnu.org
@ 2023-02-28 15:36 ` cvs-commit at gcc dot gnu.org
  2023-03-01 10:36 ` gaius at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-02-28 15:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 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:62ed1066196c81ab1fad13b2cc5ebbfe887138f9

commit r13-6378-g62ed1066196c81ab1fad13b2cc5ebbfe887138f9
Author: Gaius Mulley <gaiusmod2@gmail.com>
Date:   Tue Feb 28 15:35:12 2023 +0000

    Fix build warnings noreturn M2RTS and fix calls to RegisterModule
[PR108956]

    mc needs a fix to optionally suppress the generation of the noreturn
    attribute when building M2RTS.  All the hand built C++ modules calling
    RegisterModule must supply the library name.  These changes require
    the boot strap tools mc and pge to be rebuilt.

    gcc/m2/ChangeLog:

            PR modula2/108956
            * Make-lang.in (m2/gm2-libs-boot/M2RTS.o): New specific rule to
            add the --suppress-noreturn option.
            * Make-maintainer.in (m2/gm2-ppg-boot/$(SRC_PREFIX)M2RTS.o): New
            specific rule to add the --suppress-noreturn option.
            (m2/gm2-pg-boot/$(SRC_PREFIX)M2RTS.o): New
            specific rule to add the --suppress-noreturn option.
            (m2/gm2-pg-boot/$(SRC_PREFIX)%.o): Add missing $(srcdir).
            (m2/gm2-pge-boot/$(SRC_PREFIX)M2RTS.o): New
            specific rule to add the --suppress-noreturn option.
            (m2/gm2-pge-boot/$(SRC_PREFIX)%.o): Add missing $(srcdir).
            * gm2-libs-ch/UnixArgs.cc (LIBNAME): New define.
            (_M2_UnixArgs_ctor): Add LIBNAME parameter to RegisterModule.
            * gm2-libs-ch/dtoa.cc (LIBNAME): New define.
            (_M2_dtoa_ctor): Add LIBNAME parameter to RegisterModule.
            * gm2-libs-ch/ldtoa.cc (LIBNAME): New define.
            (_M2_ldtoa_ctor): Add LIBNAME parameter to RegisterModule.
            * pge-boot/m2rts.h (M2RTS_RegisterModule): Add libname
            parameter.
            * gm2-libs-ch/m2rts.h (M2RTS_RegisterModule): Add libname
            parameter.
            * mc-boot-ch/GUnixArgs.cc (_M2_UnixArgs_ctor): Remove.
            * pge-boot/GUnixArgs.cc (LIBNAME): New define.
            (_M2_UnixArgs_ctor): Add LIBNAME parameter to RegisterModule.
            * gm2-libs/RTint.def (AttachVector): Rename parameter.
            * mc-boot/GDynamicStrings.c: Rebuilt.
            * mc-boot/GFIO.c: Rebuilt.
            * mc-boot/GIndexing.c: Rebuilt.
            * mc-boot/GM2EXCEPTION.c: Rebuilt.
            * mc-boot/GPushBackInput.c: Rebuilt.
            * mc-boot/GRTExceptions.c: Rebuilt.
            * mc-boot/GRTint.c: Rebuilt.
            * mc-boot/GRTint.h: Rebuilt.
            * mc-boot/GStdIO.c: Rebuilt.
            * mc-boot/GStringConvert.c: Rebuilt.
            * mc-boot/GSysStorage.c: Rebuilt.
            * mc-boot/Gdecl.c: Rebuilt.
            * mc-boot/Gkeyc.c: Rebuilt.
            * mc-boot/GmcComment.c: Rebuilt.
            * mc-boot/GmcComp.c: Rebuilt.
            * mc-boot/GmcDebug.c: Rebuilt.
            * mc-boot/GmcMetaError.c: Rebuilt.
            * mc-boot/GmcOptions.c: Rebuilt.
            * mc-boot/GmcOptions.h: Rebuilt.
            * mc-boot/GmcStack.c: Rebuilt.
            * mc-boot/GnameKey.c: Rebuilt.
            * mc-boot/GsymbolKey.c: Rebuilt.
            * mc/decl.mod:: Rebuilt.
            * mc/mcOptions.def: Rebuilt.
            * mc/mcOptions.mod:: Rebuilt.
            * pge-boot/GDynamicStrings.c: Rebuilt.
            * pge-boot/GFIO.c: Rebuilt.
            * pge-boot/GIndexing.c: Rebuilt.
            * pge-boot/GM2EXCEPTION.c: Rebuilt.
            * pge-boot/GM2RTS.c: Rebuilt.
            * pge-boot/GNameKey.c: Rebuilt.
            * pge-boot/GPushBackInput.c: Rebuilt.
            * pge-boot/GRTExceptions.c: Rebuilt.
            * pge-boot/GStdIO.c: Rebuilt.
            * pge-boot/GSymbolKey.c: Rebuilt.
            * pge-boot/GSysStorage.c: Rebuilt.

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

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

* [Bug modula2/108956] [13 regression] SEGV in M2RTS_RegisterModule
  2023-02-27 21:26 [Bug modula2/108956] New: [13 regression] SEGV in M2RTS_RegisterModule ro at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2023-02-28 15:36 ` cvs-commit at gcc dot gnu.org
@ 2023-03-01 10:36 ` gaius at gcc dot gnu.org
  2023-03-01 10:37 ` ro at CeBiTec dot Uni-Bielefeld.DE
  2023-03-01 14:20 ` gaius at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: gaius at gcc dot gnu.org @ 2023-03-01 10:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Gaius Mulley <gaius at gcc dot gnu.org> ---
Do the above fixes resolve this PR ?

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

* [Bug modula2/108956] [13 regression] SEGV in M2RTS_RegisterModule
  2023-02-27 21:26 [Bug modula2/108956] New: [13 regression] SEGV in M2RTS_RegisterModule ro at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2023-03-01 10:36 ` gaius at gcc dot gnu.org
@ 2023-03-01 10:37 ` ro at CeBiTec dot Uni-Bielefeld.DE
  2023-03-01 14:20 ` gaius at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: ro at CeBiTec dot Uni-Bielefeld.DE @ 2023-03-01 10:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot Uni-Bielefeld.DE> ---
> --- Comment #6 from Gaius Mulley <gaius at gcc dot gnu.org> ---
> Do the above fixes resolve this PR ?

The revised version did indeed.  I'd included it in last night's
bootstraps and everything is fine again.  Thanks for the quick fix.

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

* [Bug modula2/108956] [13 regression] SEGV in M2RTS_RegisterModule
  2023-02-27 21:26 [Bug modula2/108956] New: [13 regression] SEGV in M2RTS_RegisterModule ro at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2023-03-01 10:37 ` ro at CeBiTec dot Uni-Bielefeld.DE
@ 2023-03-01 14:20 ` gaius at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: gaius at gcc dot gnu.org @ 2023-03-01 14:20 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #8 from Gaius Mulley <gaius at gcc dot gnu.org> ---
Many thanks for the bug report - I think it also helped the armv7l and aarch64
- timeout in runtests.  The calls to RegisterModule were generically wrong of
course on all targets.  Thanks for testing!

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

end of thread, other threads:[~2023-03-01 14:20 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-27 21:26 [Bug modula2/108956] New: [13 regression] SEGV in M2RTS_RegisterModule ro at gcc dot gnu.org
2023-02-27 21:27 ` [Bug modula2/108956] " ro at gcc dot gnu.org
2023-02-28  1:15 ` gaius at gcc dot gnu.org
2023-02-28  1:16 ` gaius at gcc dot gnu.org
2023-02-28  1:29 ` gaius at gcc dot gnu.org
2023-02-28  8:36 ` ro at CeBiTec dot Uni-Bielefeld.DE
2023-02-28 13:02 ` gaius at gcc dot gnu.org
2023-02-28 15:36 ` cvs-commit at gcc dot gnu.org
2023-03-01 10:36 ` gaius at gcc dot gnu.org
2023-03-01 10:37 ` ro at CeBiTec dot Uni-Bielefeld.DE
2023-03-01 14:20 ` 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).