public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "iains at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug modula2/108404] New: M2RTS_Halt fails with a segv (it should emit a diagnostic and exit).
Date: Sat, 14 Jan 2023 09:57:08 +0000	[thread overview]
Message-ID: <bug-108404-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 108404
           Summary: M2RTS_Halt fails with a segv (it should emit a
                    diagnostic and exit).
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: modula2
          Assignee: gaius at gcc dot gnu.org
          Reporter: iains at gcc dot gnu.org
  Target Milestone: ---

On Darwin several tests fail because there is an invalid stack size set (that
is a separate bug).

The fault should have been reported by M2RTS_Halt (it is detected correctly in
Rico.cc).

Setting a break point on the entry to M2RTS_Halt :

* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
    frame #0: 0x00000001000054f0 concurrentstore.x0`M2RTS_Halt at
M2RTS.mod:296:1
   293  
   294  PROCEDURE Halt (file: ARRAY OF CHAR; line: CARDINAL;
   295                  function: ARRAY OF CHAR; description: ARRAY OF CHAR) ;
-> 296  BEGIN
   297     ErrorMessage (description, file, line, function) ;
   298     HALT
   299  END Halt ;

examining the registers:

(lldb) reg read
General Purpose Registers:
       rax = 0x0000000000000016
       rbx = 0x0000600002c08118
       rcx = 0x0000000100014c00  "failed to set stack size attribute"
       rdx = 0x0000000100014bf2  "initThread"
       rdi = 0x0000000100014b00 
"/src-local/gcc-master/libgm2/libm2iso/RTco.cc"
       rsi = 0x0000000000000172

this is correct ABI - RDI - file, RSI = line number, RDX = function, RCX =
message.
(four integer/pointer arguments).

---- however if we continue from this point ...

* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS
(code=2, address=0x3014e7178)
    frame #0: 0x000000010000554f concurrentstore.x0`M2RTS_Halt at
M2RTS.mod:296:1
   293  
   294  PROCEDURE Halt (file: ARRAY OF CHAR; line: CARDINAL;
   295                  function: ARRAY OF CHAR; description: ARRAY OF CHAR) ;
-> 296  BEGIN
   297     ErrorMessage (description, file, line, function) ;

I cannot (at present) debug this further since I do not have an installed
debugger that supports Module-2 (but it might  well repeat on Linux - the ABI
is basically the same).  In any case, it seems likely that the problem is in
the prologue or very early in the function since the break line is on BEGIN in
both cases.

             reply	other threads:[~2023-01-14  9:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-14  9:57 iains at gcc dot gnu.org [this message]
2023-01-15 20:48 ` [Bug modula2/108404] " gaius at gcc dot gnu.org
2023-01-16  8:32 ` gaius at gcc dot gnu.org
2023-01-16 18:25 ` gaius at gcc dot gnu.org
2023-01-16 23:05 ` iains at gcc dot gnu.org
2023-01-17 16:15 ` gaius at gcc dot gnu.org
2023-01-17 19:52 ` iains at gcc dot gnu.org
2023-08-05 17:35 ` gaius at gcc dot gnu.org
2023-08-10 12:21 ` iains at gcc dot gnu.org
2023-08-10 12:49 ` gaius at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-108404-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).