public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c/96365] New: GCC report impossible constraint on possible inline assembly output constraints @ 2020-07-29 9:15 141242068 at smail dot nju.edu.cn 2020-07-29 9:18 ` [Bug c/96365] " jakub at gcc dot gnu.org ` (2 more replies) 0 siblings, 3 replies; 4+ messages in thread From: 141242068 at smail dot nju.edu.cn @ 2020-07-29 9:15 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96365 Bug ID: 96365 Summary: GCC report impossible constraint on possible inline assembly output constraints Product: gcc Version: 9.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: 141242068 at smail dot nju.edu.cn Target Milestone: --- $ cat a.c int main() { int x = 0, y = 0, z = 0; asm("" : "=ab"(x), "=bc"(y), "=c"(z)); return 0; } Inline assembly at line 3 is a possible constraint, compiler can allocate eax for x, ebx for y, ecx for z, but GCC report that this asm has impossible constraint as below: -> tmp $ gcc a.c asm.c: In function ‘main’: asm.c:3:3: error: ‘asm’ operand has impossible constraints 3 | asm("" : "=ab"(x), "=bc"(y), "=c"(z)); | ^~~ My gcc version: -> tmp $ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none:hsa OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-10ubuntu2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2) ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/96365] GCC report impossible constraint on possible inline assembly output constraints 2020-07-29 9:15 [Bug c/96365] New: GCC report impossible constraint on possible inline assembly output constraints 141242068 at smail dot nju.edu.cn @ 2020-07-29 9:18 ` jakub at gcc dot gnu.org 2020-07-29 10:12 ` 141242068 at smail dot nju.edu.cn 2023-06-14 12:38 ` [Bug middle-end/96365] " 141242068 at smail dot nju.edu.cn 2 siblings, 0 replies; 4+ messages in thread From: jakub at gcc dot gnu.org @ 2020-07-29 9:18 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96365 Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Any reason why you can't just write "=a"(x), "=b"(y), "=c"(z) if you mean that as the only possibility? ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/96365] GCC report impossible constraint on possible inline assembly output constraints 2020-07-29 9:15 [Bug c/96365] New: GCC report impossible constraint on possible inline assembly output constraints 141242068 at smail dot nju.edu.cn 2020-07-29 9:18 ` [Bug c/96365] " jakub at gcc dot gnu.org @ 2020-07-29 10:12 ` 141242068 at smail dot nju.edu.cn 2023-06-14 12:38 ` [Bug middle-end/96365] " 141242068 at smail dot nju.edu.cn 2 siblings, 0 replies; 4+ messages in thread From: 141242068 at smail dot nju.edu.cn @ 2020-07-29 10:12 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96365 --- Comment #2 from wierton <141242068 at smail dot nju.edu.cn> --- (In reply to Jakub Jelinek from comment #1) > Any reason why you can't just write "=a"(x), "=b"(y), "=c"(z) if you mean > that as the only possibility? Emm, I was studying the inline assembly by reading the manual on https://gcc.gnu.org/onlinedocs/gcc/Using-Assembly-Language-with-C.html#Using-Assembly-Language-with-C. This example was accidently found because I wondered that if GCC really considers constraints allocation as constraint solving problem. It seems that GCC takes simpler strategy such as greedy algorithm and this may violate the specification. I was not very sure if it is really inconsistent with specification (I failed in finding accurate description), but I thought posting this example may help improve the quality of GCC (or specification). ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug middle-end/96365] GCC report impossible constraint on possible inline assembly output constraints 2020-07-29 9:15 [Bug c/96365] New: GCC report impossible constraint on possible inline assembly output constraints 141242068 at smail dot nju.edu.cn 2020-07-29 9:18 ` [Bug c/96365] " jakub at gcc dot gnu.org 2020-07-29 10:12 ` 141242068 at smail dot nju.edu.cn @ 2023-06-14 12:38 ` 141242068 at smail dot nju.edu.cn 2 siblings, 0 replies; 4+ messages in thread From: 141242068 at smail dot nju.edu.cn @ 2023-06-14 12:38 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96365 wierton <141242068 at smail dot nju.edu.cn> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |WONTFIX --- Comment #3 from wierton <141242068 at smail dot nju.edu.cn> --- Compiler has no need to take it as a CSP problem. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-06-14 12:38 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-07-29 9:15 [Bug c/96365] New: GCC report impossible constraint on possible inline assembly output constraints 141242068 at smail dot nju.edu.cn 2020-07-29 9:18 ` [Bug c/96365] " jakub at gcc dot gnu.org 2020-07-29 10:12 ` 141242068 at smail dot nju.edu.cn 2023-06-14 12:38 ` [Bug middle-end/96365] " 141242068 at smail dot nju.edu.cn
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).