public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "macro@linux-mips.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/95637] New: Read-only data assigned to `.sdata' rather than `.rodata'
Date: Thu, 11 Jun 2020 11:15:11 +0000	[thread overview]
Message-ID: <bug-95637-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 95637
           Summary: Read-only data assigned to `.sdata' rather than
                    `.rodata'
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: macro@linux-mips.org
  Target Milestone: ---
            Target: riscv*-*-linux-gnu

As observed in PR fortran/95631 read-only data gets assigned to `.sdata'
rather than `.rodata', which in turn causes invalid attempts to modify it
not to be trapped at run time.

A test case from the PR referred is:

C
C     CHANGE THE VALUE OF 4
C

      CALL INC(4)
      WRITE (*, 30) 4
30    FORMAT ('2+2=',I4)
      END

      SUBROUTINE INC(I)
      I = I + 1
      END

which is supposed to trap on the modification of literal 4 in INC.
Instead the program runs to completion and prints:

2+2=   5

I have no C language test case at hand, but I guess it does not matter,
this one is sweet and simple.

             reply	other threads:[~2020-06-11 11:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-11 11:15 macro@linux-mips.org [this message]
2020-06-11 21:06 ` [Bug target/95637] " wilson at gcc dot gnu.org
2020-06-12 21:37 ` macro@linux-mips.org
2020-06-15 23:21 ` wilson at gcc dot gnu.org
2020-06-23 22:58 ` macro@linux-mips.org
2020-06-28 10:40 ` ebotcazou at gcc dot gnu.org
2020-06-30  0:05 ` LpSolit at gmail dot com

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-95637-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).