public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "gareth.webb+gccbugzilla at outlook dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/103979] New: asm goto is not considered volatile Date: Tue, 11 Jan 2022 16:29:03 +0000 [thread overview] Message-ID: <bug-103979-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103979 Bug ID: 103979 Summary: asm goto is not considered volatile Product: gcc Version: 11.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: gareth.webb+gccbugzilla at outlook dot com Target Milestone: --- Created attachment 52165 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52165&action=edit Minimal reproduction of bug I have discovered a bug with GCC's 'asm goto'. It is documented that "note that an asm goto statement is always implicitly considered volatile." but it is not. It is using the same heuristic as non-goto asm (no outputs => volatile. outputs => not-volatile, unless explicitly specified). This can result in the optimizer removing the asm block completely. Confirmed the bug is present on Ubuntu 20.10's gcc package, as well as my own build from source (tag: releases/gcc-11.2.0). A minimal pre-processed reproduction is attached. Compile with gcc -O2 -c asmgoto.c -o asmgoto.o, observe the disassembled output contains nothing but endb64/ret, no jmp. I also received an ICE at one point when trying to create a minimal reproduction, but could not reproduce. It's included below, but as I can't reproduce I don't know how useful it will be. Ubuntu package: Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.2.0-7ubuntu2' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c, ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-share d --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enabl e-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --ena ble-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiar ch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload -targets=nvptx-none=/build/gcc-11-ZPT0kp/gcc-11-11.2.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-ZPT0kp/gcc-11-11.2.0/debian/tmp-gcn/usr --without-cu da-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enab le-link-serialization=2 Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 11.2.0 (Ubuntu 11.2.0-7ubuntu2) Myy own build: Using built-in specs. COLLECT_GCC=x86_64-elf-gcc COLLECT_LTO_WRAPPER=/home/gwebb/opt/cross/libexec/gcc/x86_64-elf/11.2.0/lto-wrapper Target: x86_64-elf Configured with: ../gcc/configure --target=x86_64-elf --prefix=/home/gwebb/opt/cross --disable-nls --enable-languages=c --without-headers Thread model: single Supported LTO compression algorithms: zlib gcc version 11.2.0 (GCC) Possibly related ICE? during RTL pass: fwprop1 gdt.c: In function 'flush_gdt': gdt.c:66:1: internal compiler error: in purge_dead_edges, at cfgrtl.c:3346 66 | } | ^ 0x5d253d purge_dead_edges(basic_block_def*) ../../gcc/gcc/cfgrtl.c:3346 0x143dc1f delete_trivially_dead_insns(rtx_insn*, int) ../../gcc/gcc/cse.c:7178 0x145baa9 fwprop_done ../../gcc/gcc/fwprop.c:917 0x145baa9 fwprop ../../gcc/gcc/fwprop.c:1001 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions.
next reply other threads:[~2022-01-11 16:29 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-01-11 16:29 gareth.webb+gccbugzilla at outlook dot com [this message] 2022-01-11 18:46 ` [Bug rtl-optimization/103979] asm goto is not considered volatile with output operands pinskia at gcc dot gnu.org 2023-01-25 22:17 ` pinskia at gcc dot gnu.org 2023-01-30 18:06 ` jakub at gcc dot gnu.org 2023-01-30 18:18 ` jakub at gcc dot gnu.org 2023-06-26 23:38 ` [Bug middle-end/103979] " pinskia at gcc dot gnu.org 2023-06-26 23:53 ` pinskia at gcc dot gnu.org 2023-06-27 0:10 ` pinskia at gcc dot gnu.org 2023-06-27 3:26 ` pinskia at gcc dot gnu.org 2023-06-27 16:28 ` cvs-commit at gcc dot gnu.org 2023-06-27 16:29 ` pinskia at gcc dot gnu.org 2023-06-27 16:46 ` cvs-commit at gcc dot gnu.org 2023-06-27 17:21 ` cvs-commit at gcc dot gnu.org 2023-06-27 17:24 ` pinskia 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-103979-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: linkBe 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).