[Bug c/95652] New: GCC 8.3.1 generates syntactically incorrect assembly code
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95652 Bug ID: 95652 Summary: GCC 8.3.1 generates syntactically incorrect assembly code Product: gcc Version: 8.3.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: teo.samarzija at gmail dot com Target Milestone: --- Hey, guys! So, I think I've found a bug in GCC 8.3.1 that occurs on Linux. Here is a simple test case: int printf(const char*,...); float eax; int main() { eax=7; printf("%lf\n",eax); } When compiled with "gcc -masm=intel -o test test.c", I get the error messages: /tmp/ccGiemfM.s: Assembler messages: /tmp/ccGiemfM.s:20: Error: invalid use of register /tmp/ccGiemfM.s:21: Error: invalid use of register It appears as though GCC 8.3.1 generates syntactically incorrect assembly code for that. Possibly related: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52554
[Bug c/95652] GCC 8.3.1 generates syntactically incorrect assembly code
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95652 --- Comment #1 from Teo Samarzija --- Possibly related, "as --version" prints: GNU assembler (GNU Binutils) 2.33.1 Copyright (C) 2019 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or later. This program has absolutely no warranty. This assembler was configured for a target of `x86_64-pc-linux-gnu'.
[Bug target/95652] GCC 8.3.1 generates syntactically incorrect assembly code with -masm=intel
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95652 --- Comment #3 from Teo Samarzija --- (In reply to Andrew Pinski from comment #2) > This looks closer to a dup of bug 87986. > > Basically -masm=intel is not always working. When does it occur? Maybe we can determine when it can occur and warn about it? As far I can tell, it occurs when you use a reserved word in assembly as the name of the global variable, and only under Linux (not under Windows, since the names of global variables on Windows get prepended '_'). Why exactly does GCC use such a different convention for Windows and Linux? Perhaps you can change that. Besides, how does CLANG compile that same code fine, also under Linux and with "-masm=intel"? Maybe you can copy the way CLANG does that.
[Bug target/95652] GCC 8.3.1 generates syntactically incorrect assembly code with -masm=intel
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95652 --- Comment #5 from Teo Samarzija --- (In reply to Uroš Bizjak from comment #4) > (In reply to Teo Samarzija from comment #3) > > Besides, how does CLANG compile that same code fine, also under Linux and > > with "-masm=intel"? Maybe you can copy the way CLANG does that. > > Clang outputs: > > mov dword ptr [rip + eax], 1088421888 > > which gld does't understand: > > pr95652.s: Assembler messages: > pr95652.s:17: Error: `dword ptr [rip+eax]' is not a valid base/index > expression Which version of CLANG? CLANG 9.0 compiles the code in the opening post correctly (under Linux and using Intel Syntax).
[Bug c/95800] New: DJGPP 9.3.1 doesn't parse C files correctly
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95800 Bug ID: 95800 Summary: DJGPP 9.3.1 doesn't parse C files correctly Product: gcc Version: 9.3.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: teo.samarzija at gmail dot com Target Milestone: --- So, the C library I am using to cross-compile programs from Linux to DOS apparently doesn't support the "log2" function, and I tried to polyfill it: #include double log2(double x) { return log(x)/log(2); } int main() { return 0; } However, when I do that, I get the following error, and the linking doesn't even begin: test.c:3:8: error: expected ')' before '/' token 3 | double log2(double x) |^~~~ Here is what "djgpp-gcc -v" prints: Using built-in specs. COLLECT_GCC=djgpp-gcc COLLECT_LTO_WRAPPER=/home/teo.samarzija/djgpp-9.3.0/libexec/gcc/djgpp/9.3.0/lto-wrapper Target: djgpp Configured with: ../gcc-9.3.0/configure --target=djgpp --prefix=/home/teo.samarzija/djgpp-9.3.0 --enable-languages=c,c++,objc,ada,fortran,go Thread model: single gcc version 9.3.0 (GCC)
[Bug c/95800] DJGPP 9.3.1 doesn't parse C files correctly
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95800 --- Comment #2 from Teo Samarzija --- (In reply to Jakub Jelinek from comment #1) > Perhaps log2 is in DJGPP a macro (which the C standard allows)? > In that case, you either need to #undef that macro, or > use double (log2)(double x) { ... } I am sorry, apparently it is defined as a macro. I don't know why I am getting linker errors telling me "log2" is undefined.