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: ma...@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.