public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug modula2/110174] New: Using illegal constraints for builtin return_address gives ICE @ 2023-06-08 14:18 admin@tho-otto.de 2023-07-22 9:39 ` [Bug modula2/110174] " gaius at gcc dot gnu.org ` (4 more replies) 0 siblings, 5 replies; 6+ messages in thread From: admin@tho-otto.de @ 2023-06-08 14:18 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110174 Bug ID: 110174 Summary: Using illegal constraints for builtin return_address gives ICE Product: gcc Version: 13.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: modula2 Assignee: gaius at gcc dot gnu.org Reporter: admin@tho-otto.de Target Milestone: --- When compiling the the following module with -O2 MODULE foo; FROM Builtins IMPORT return_address; FROM SYSTEM IMPORT ADDRESS; VAR x: ADDRESS; PROCEDURE test(); BEGIN ASM VOLATILE("" : "=m"(x) : "m"(return_address(0)) : ); END test; BEGIN test(); END foo. I get an ICE: during RTL pass: expand In function ‘test’, inlined from ‘_M2_foo_init’ at foo.mod:13:3: foo.mod:9:56: internal compiler error: in expand_asm_stmt, at cfgexpand.cc:3419 9 | ASM VOLATILE("" : "=m"(x) : "m"(return_address(0)) : ); | ^ The ICE is triggered at https://github.com/gcc-mirror/gcc/blob/9589a46ddadc8b93c224c3f84fa94746c04596bf/gcc/cfgexpand.cc#L3419 Using "m" as constraint is actually wrong, however the C backend handles that correctly: foo.c:5:39: error: memory input 1 is not directly addressable 5 | __asm__ volatile("" : "=m"(x) : "m"(__builtin_return_address(0)) : ); ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug modula2/110174] Using illegal constraints for builtin return_address gives ICE 2023-06-08 14:18 [Bug modula2/110174] New: Using illegal constraints for builtin return_address gives ICE admin@tho-otto.de @ 2023-07-22 9:39 ` gaius at gcc dot gnu.org 2023-07-24 19:14 ` gaius at gcc dot gnu.org ` (3 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: gaius at gcc dot gnu.org @ 2023-07-22 9:39 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110174 Gaius Mulley <gaius at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2023-07-22 Ever confirmed|0 |1 Status|UNCONFIRMED |ASSIGNED --- Comment #1 from Gaius Mulley <gaius at gcc dot gnu.org> --- Confirmed - thanks for the bug report and test code - will fix! ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug modula2/110174] Using illegal constraints for builtin return_address gives ICE 2023-06-08 14:18 [Bug modula2/110174] New: Using illegal constraints for builtin return_address gives ICE admin@tho-otto.de 2023-07-22 9:39 ` [Bug modula2/110174] " gaius at gcc dot gnu.org @ 2023-07-24 19:14 ` gaius at gcc dot gnu.org 2023-07-25 2:21 ` cvs-commit at gcc dot gnu.org ` (2 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: gaius at gcc dot gnu.org @ 2023-07-24 19:14 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110174 --- Comment #2 from Gaius Mulley <gaius at gcc dot gnu.org> --- Created attachment 55625 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55625&action=edit Proposed fix Here is a patch for gcc-14 which exhibits the same bug. Will apply to git once a full bootstrap has successfully completed. I'll also back port this bugfix. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug modula2/110174] Using illegal constraints for builtin return_address gives ICE 2023-06-08 14:18 [Bug modula2/110174] New: Using illegal constraints for builtin return_address gives ICE admin@tho-otto.de 2023-07-22 9:39 ` [Bug modula2/110174] " gaius at gcc dot gnu.org 2023-07-24 19:14 ` gaius at gcc dot gnu.org @ 2023-07-25 2:21 ` cvs-commit at gcc dot gnu.org 2023-07-31 0:06 ` cvs-commit at gcc dot gnu.org 2023-07-31 0:08 ` gaius at gcc dot gnu.org 4 siblings, 0 replies; 6+ messages in thread From: cvs-commit at gcc dot gnu.org @ 2023-07-25 2:21 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110174 --- Comment #3 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:c4637cbed3f23095b98962b41063380c4ab9eda9 commit r14-2757-gc4637cbed3f23095b98962b41063380c4ab9eda9 Author: Gaius Mulley <gaiusmod2@gmail.com> Date: Tue Jul 25 03:21:12 2023 +0100 PR modula2/110174 Bugfixes to M2GenGCC.mod:CodeInline preventing an ICE This patch calls skip_const_decl before chaining parameter values and ensures that all strings passed to build_stmt (..., ASM_EXPR, ...) are nul terminated. It also improves the accuracy of locations in function calls and asm statements. gcc/m2/ PR modula2/110174 * gm2-compiler/M2GCCDeclare.def (PromoteToCString): New procedure function. * gm2-compiler/M2GCCDeclare.mod (PromoteToCString): New procedure function. * gm2-compiler/M2GenGCC.mod (BuildTreeFromInterface): Call skip_const_decl before chaining the parameter value. Use PromoteToCString to ensure the string is nul terminated. (CodeInline): Remove all parameters and replace with quad. Use GetQuadOtok to get operand token numbers. Remove call to DeclareConstant and replace it with PromoteToCString. * gm2-compiler/M2Quads.def (BuildInline): Rename into ... (BuildAsm): ... this. * gm2-compiler/M2Quads.mod: (BuildInline): Rename into ... (BuildAsm): ... this. (BuildAsmElement): Add debugging. * gm2-compiler/P1Build.bnf: Remove import of BuildInline. * gm2-compiler/P2Build.bnf: Remove import of BuildInline. * gm2-compiler/P3Build.bnf: Remove import of BuildInline and import BuildAsm. * gm2-compiler/PHBuild.bnf: Remove import of BuildInline. * gm2-libs-iso/SysClock.mod (foo): Remove. * gm2-libs/FIO.mod (BufferedRead): Rename parameter a to dest. Rename variable t to src. * m2pp.cc (pf): Correct block comment. (pe): Correct block comment. (m2pp_asm_expr): New function. (m2pp_statement): Call m2pp_asm_expr. gcc/testsuite/ PR modula2/110174 * gm2/pim/pass/program2.mod: Remove import of BuildInline. * gm2/extensions/asm/fail/extensions-asm-fail.exp: New test. * gm2/extensions/asm/fail/stressreturn.mod: New test. * gm2/extensions/asm/pass/extensions-asm-pass.exp: New test. * gm2/extensions/asm/pass/fooasm.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com> ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug modula2/110174] Using illegal constraints for builtin return_address gives ICE 2023-06-08 14:18 [Bug modula2/110174] New: Using illegal constraints for builtin return_address gives ICE admin@tho-otto.de ` (2 preceding siblings ...) 2023-07-25 2:21 ` cvs-commit at gcc dot gnu.org @ 2023-07-31 0:06 ` cvs-commit at gcc dot gnu.org 2023-07-31 0:08 ` gaius at gcc dot gnu.org 4 siblings, 0 replies; 6+ messages in thread From: cvs-commit at gcc dot gnu.org @ 2023-07-31 0:06 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110174 --- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-13 branch has been updated by Gaius Mulley <gaius@gcc.gnu.org>: https://gcc.gnu.org/g:c8024088ccc263833d005afe7df835109db1965b commit r13-7659-gc8024088ccc263833d005afe7df835109db1965b Author: Gaius Mulley <gaiusmod2@gmail.com> Date: Mon Jul 31 01:05:20 2023 +0100 PR modula2/110174 Bugfixes to M2GenGCC.mod:CodeInline preventing an ICE This patch calls skip_const_decl before chaining parameter values and ensures that all strings passed to build_stmt (..., ASM_EXPR, ...) are nul terminated. It also improves the accuracy of locations in function calls and asm statements. gcc/m2/ PR modula2/110174 * gm2-compiler/M2GCCDeclare.def (PromoteToCString): New procedure function. * gm2-compiler/M2GCCDeclare.mod (PromoteToCString): New procedure function. * gm2-compiler/M2GenGCC.mod (BuildTreeFromInterface): Call skip_const_decl before chaining the parameter value. Use PromoteToCString to ensure the string is nul terminated. (CodeInline): Remove all parameters and replace with quad. Use GetQuadOtok to get operand token numbers. Remove call to DeclareConstant and replace it with PromoteToCString. * gm2-compiler/M2Quads.def (BuildInline): Rename into ... (BuildAsm): ... this. * gm2-compiler/M2Quads.mod: (BuildInline): Rename into ... (BuildAsm): ... this. (BuildAsmElement): Add debugging. * gm2-compiler/P1Build.bnf: Remove import of BuildInline. * gm2-compiler/P2Build.bnf: Remove import of BuildInline. * gm2-compiler/P3Build.bnf: Remove import of BuildInline and import BuildAsm. * gm2-compiler/PHBuild.bnf: Remove import of BuildInline. * gm2-libs-iso/SysClock.mod (foo): Remove. * gm2-libs/FIO.mod (BufferedRead): Rename parameter a to dest. Rename variable t to src. * m2pp.cc (pf): Correct block comment. (pe): Correct block comment. (m2pp_asm_expr): New function. (m2pp_statement): Call m2pp_asm_expr. gcc/testsuite/ PR modula2/110174 * gm2/pim/pass/program2.mod: Remove import of BuildInline. * gm2/extensions/asm/fail/extensions-asm-fail.exp: New test. * gm2/extensions/asm/fail/stressreturn.mod: New test. * gm2/extensions/asm/pass/extensions-asm-pass.exp: New test. * gm2/extensions/asm/pass/fooasm.mod: New test. (cherry picked from commit c4637cbed3f23095b98962b41063380c4ab9eda9) Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com> ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug modula2/110174] Using illegal constraints for builtin return_address gives ICE 2023-06-08 14:18 [Bug modula2/110174] New: Using illegal constraints for builtin return_address gives ICE admin@tho-otto.de ` (3 preceding siblings ...) 2023-07-31 0:06 ` cvs-commit at gcc dot gnu.org @ 2023-07-31 0:08 ` gaius at gcc dot gnu.org 4 siblings, 0 replies; 6+ messages in thread From: gaius at gcc dot gnu.org @ 2023-07-31 0:08 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110174 Gaius Mulley <gaius at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution|--- |FIXED --- Comment #5 from Gaius Mulley <gaius at gcc dot gnu.org> --- Closing now that the patch has been applied to the gcc-13 branch. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-07-31 0:08 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-06-08 14:18 [Bug modula2/110174] New: Using illegal constraints for builtin return_address gives ICE admin@tho-otto.de 2023-07-22 9:39 ` [Bug modula2/110174] " gaius at gcc dot gnu.org 2023-07-24 19:14 ` gaius at gcc dot gnu.org 2023-07-25 2:21 ` cvs-commit at gcc dot gnu.org 2023-07-31 0:06 ` cvs-commit at gcc dot gnu.org 2023-07-31 0:08 ` 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).