public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug bootstrap/107860] New: Compilation failure, ambiguous fisttp
@ 2022-11-24 16:45 simon at pushface dot org
  2022-11-24 17:05 ` [Bug target/107860] " pinskia at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: simon at pushface dot org @ 2022-11-24 16:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107860

            Bug ID: 107860
           Summary: Compilation failure, ambiguous fisttp
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: bootstrap
          Assignee: unassigned at gcc dot gnu.org
          Reporter: simon at pushface dot org
  Target Milestone: ---

Building the snapshot gcc-13-20221120 on macOS 13 (actually an aarch64 machine,
but using x86_64-apple-darwin21 compiler under Rosetta) with Command Line Tools
14.1.
Source patched as commit ac50541 for PR107781.

Phase 1 (actually configured with --disable-bootstrap) fails with this (I was
building with -j7, so had to extract the relevant parts of the log:

checking __sync extensions...
/Volumes/Miscellaneous1/x86_64/gcc-13-20221120/gcc/./gcc/xgcc
-B/Volumes/Miscellaneous1/x86_64/gcc-13-20221120/gcc/./gcc/
-B/opt/gcc-13-20221120/x86_64-apple-darwin21/bin/
-B/opt/gcc-13-20221120/x86_64-apple-darwin21/lib/ -isystem
/opt/gcc-13-20221120/x86_64-apple-darwin21/include -isystem
/opt/gcc-13-20221120/x86_64-apple-darwin21/sys-include
--sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk   -c -g -O2 
-fno-common  -W -Wall -gnatpg -nostdinc  -fno-toplevel-reorder  \
          g-debpoo.adb -o g-debpoo.o
...
/var/folders/ch/k_zwspdx3qsfbt1_x21zld6m0000gn/T//ccJJp5X6.s:11992:2: error:
ambiguous instructions require an explicit suffix (could be 'fisttps', or
'fisttpl')
        fisttp  -408(%rbp)
        ^
/var/folders/ch/k_zwspdx3qsfbt1_x21zld6m0000gn/T//ccJJp5X6.s:12278:2: error:
ambiguous instructions require an explicit suffix (could be 'fisttps', or
'fisttpl')
        fisttp  -408(%rbp)
        ^
...
make[6]: *** [g-debpoo.o] Error 1

Configure script (BUILD set to x86_64-apple-darwin21):
+++++++++++++++
XCODE=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
CLU=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk

$GCC_SRC/configure                                                      \
  --prefix=$PREFIX                                                      \
  --without-libiconv-prefix                                             \
  --disable-libmudflap                                                  \
  --disable-libstdcxx-pch                                               \
  --disable-libsanitizer                                                \
  --disable-libcc1                                                      \
  --disable-libcilkrts                                                  \
  --disable-multilib                                                    \
  --disable-nls                                                         \
  --enable-languages=c,c++,ada                                          \
  --host=$BUILD                                                         \
  --target=$BUILD                                                       \
  --build=$BUILD                                                        \
  --without-isl                                                         \
  --with-build-sysroot="$(xcrun --show-sdk-path)"                       \
  --with-sysroot=                                                       \
  --with-specs="%{!sysroot=*:--sysroot=%:if-exists-else($XCODE $CLU)}"  \
  --with-build-config=no                                                \
  --disable-bootstrap                                                   \
   CFLAGS=-Wno-deprecated-declarations                                  \
   CXXFLAGS=-Wno-deprecated-declarations
+++++++++++

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/107860] Compilation failure, ambiguous fisttp
  2022-11-24 16:45 [Bug bootstrap/107860] New: Compilation failure, ambiguous fisttp simon at pushface dot org
@ 2022-11-24 17:05 ` pinskia at gcc dot gnu.org
  2022-11-24 17:06 ` pinskia at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-24 17:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107860

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Can you attach config.log from the gcc directory?

It should have done detected filds :

    gcc_GAS_CHECK_FEATURE([filds and fists mnemonics],
       gcc_cv_as_ix86_filds,,
       [filds (%ebp); fists (%ebp)],,
       [AC_DEFINE(HAVE_AS_IX86_FILDS, 1,
         [Define if your assembler uses filds and fists mnemonics.])])

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/107860] Compilation failure, ambiguous fisttp
  2022-11-24 16:45 [Bug bootstrap/107860] New: Compilation failure, ambiguous fisttp simon at pushface dot org
  2022-11-24 17:05 ` [Bug target/107860] " pinskia at gcc dot gnu.org
@ 2022-11-24 17:06 ` pinskia at gcc dot gnu.org
  2022-11-24 17:35 ` simon at pushface dot org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-24 17:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107860

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2022-11-24
     Ever confirmed|0                           |1

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/107860] Compilation failure, ambiguous fisttp
  2022-11-24 16:45 [Bug bootstrap/107860] New: Compilation failure, ambiguous fisttp simon at pushface dot org
  2022-11-24 17:05 ` [Bug target/107860] " pinskia at gcc dot gnu.org
  2022-11-24 17:06 ` pinskia at gcc dot gnu.org
@ 2022-11-24 17:35 ` simon at pushface dot org
  2022-11-24 17:41 ` simon at pushface dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: simon at pushface dot org @ 2022-11-24 17:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107860

--- Comment #2 from simon at pushface dot org ---
Created attachment 53960
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53960&action=edit
gcc/config.log

As requested

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/107860] Compilation failure, ambiguous fisttp
  2022-11-24 16:45 [Bug bootstrap/107860] New: Compilation failure, ambiguous fisttp simon at pushface dot org
                   ` (2 preceding siblings ...)
  2022-11-24 17:35 ` simon at pushface dot org
@ 2022-11-24 17:41 ` simon at pushface dot org
  2022-11-24 17:45 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: simon at pushface dot org @ 2022-11-24 17:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107860

--- Comment #3 from simon at pushface dot org ---
Created attachment 53961
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53961&action=edit
gcc/config.log

As requested (this time, sorry about previous attempt)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/107860] Compilation failure, ambiguous fisttp
  2022-11-24 16:45 [Bug bootstrap/107860] New: Compilation failure, ambiguous fisttp simon at pushface dot org
                   ` (3 preceding siblings ...)
  2022-11-24 17:41 ` simon at pushface dot org
@ 2022-11-24 17:45 ` pinskia at gcc dot gnu.org
  2022-11-24 17:46 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-24 17:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107860

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |UNCONFIRMED
     Ever confirmed|1                           |0

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---

configure:27158: checking assembler for filds and fists mnemonics
configure:27167: /usr/bin/as    -o conftest.o conftest.s >&5
conftest.s:1:8: error: unknown token in expression
filds (%ebp); fists (%ebp)
       ^
conftest.s:1:7: error: invalid operand
filds (%ebp); fists (%ebp)
      ^

Oh this is a configure issue on how to test as here.
But I don't know exactly how to fix it really because GCC configure with no
option is the right thing to do for the target.

You might need a wrapper as to do the right thing really for this kind of
building ....

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/107860] Compilation failure, ambiguous fisttp
  2022-11-24 16:45 [Bug bootstrap/107860] New: Compilation failure, ambiguous fisttp simon at pushface dot org
                   ` (4 preceding siblings ...)
  2022-11-24 17:45 ` pinskia at gcc dot gnu.org
@ 2022-11-24 17:46 ` pinskia at gcc dot gnu.org
  2022-11-25 14:02 ` simon at pushface dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-24 17:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107860

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
               Host|x86_64-apple-darwin21       |aarch64-apple-darwin21
              Build|x86_64-apple-darwin21       |aarch64-apple-darwin21

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note you could in theory just build a cross compiler but you still need a
wrapper as to configure to detect the correct thing ....

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/107860] Compilation failure, ambiguous fisttp
  2022-11-24 16:45 [Bug bootstrap/107860] New: Compilation failure, ambiguous fisttp simon at pushface dot org
                   ` (5 preceding siblings ...)
  2022-11-24 17:46 ` pinskia at gcc dot gnu.org
@ 2022-11-25 14:02 ` simon at pushface dot org
  2022-11-25 14:08 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: simon at pushface dot org @ 2022-11-25 14:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107860

--- Comment #6 from simon at pushface dot org ---
The situation with aarch64-apple-darwin vs x86_64-apple-darwin isn't I think
quite like the standard cross-compilation scenario, because of Apple's Rosetta
x86_64 emulation and the fact that all the low-level tools (as, ld, ...)
support both architectures.

If I take an x86_64-apple-darwin compiler and run it on aarch64-apple-darwin it
will generate x86_64 assembler and invoke as, ld with the right switches to
create x86_84 binaries and executables; the executables will run on aarch64
under Rosetta or on x86_64 natively.

So I'm not sure what --build, --host should have been set to (given I don't
want a cross-compiler; the cross- facilities are provided by macOS under the
hood).

In what I was trying to do, the host machine was aarch64-apple-darwin22, but
notably aarch64 running Rosetta. The boot compiler was x86_64-apple-darwin21.

Anyway, the issue here was the way that configure invoked the assembler;
/usr/bin/as will assume it's targeting aarch64 (aka arm64) unless told
different.

These are the results of compiling the test case:

   $ cat conftest-filds-fists.s
   // $gcc_cv_as $gcc_cv_as_flags  -o conftest.o conftest.s
           filds (%ebp)
           fists (%ebp)

with /usr/bin/as -c -b conftest-filds-fists.s -o conftest-filds-fists.o

(a) on x86_64

Apple clang version 14.0.0 (clang-1400.0.29.201)
Target: x86_64-apple-darwin21.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
 "/Library/Developer/CommandLineTools/usr/bin/clang" -cc1as -triple
x86_64-apple-macosx12.0.0 -filetype obj -main-file-name conftest-filds-fists.s
-target-cpu penryn -fdebug-compilation-dir=/Users/simon/tmp
-dwarf-debug-producer "Apple clang version 14.0.0 (clang-1400.0.29.201)"
-dwarf-version=4 -mrelocation-model pic --mrelax-relocations -mllvm
-disable-aligned-alloc-awareness=1 -o conftest-filds-fists.o
conftest-filds-fists.s

(b) on aarch64

$ /usr/bin/as -c -v conftest-filds-fists.s -o conftest-filds-fists.o
Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: arm64-apple-darwin22.1.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
 "/Library/Developer/CommandLineTools/usr/bin/clang" -cc1as -triple
arm64-apple-macosx13.0.0 -filetype obj -main-file-name conftest-filds-fists.s
-target-cpu apple-m1 -target-feature +v8.5a -target-feature +fp-armv8
-target-feature +neon -target-feature +crc -target-feature +crypto
-target-feature +dotprod -target-feature +fp16fml -target-feature +ras
-target-feature +lse -target-feature +rdm -target-feature +rcpc -target-feature
+zcm -target-feature +zcz -target-feature +fullfp16 -target-feature +sm4
-target-feature +sha3 -target-feature +sha2 -target-feature +aes
-fdebug-compilation-dir=/Volumes/Miscellaneous1/x86_64/gcc-13-20221120/gcc
-dwarf-debug-producer "Apple clang version 14.0.0 (clang-1400.0.29.202)"
-dwarf-version=4 -mrelocation-model pic --mrelax-relocations -mllvm
-disable-aligned-alloc-awareness=1 -o conftest-filds-fists.o
conftest-filds-fists.s
conftest-filds-fists.s:2:16: error: unknown token in expression
        filds (%ebp)
               ^
conftest-filds-fists.s:2:15: error: invalid operand
        filds (%ebp)
              ^
conftest-filds-fists.s:3:16: error: unknown token in expression
        fists (%ebp)
               ^
conftest-filds-fists.s:3:15: error: invalid operand
        fists (%ebp)
              ^
(c) on aarch64, with -arch x86_64

$ /usr/bin/as -c -v conftest-filds-fists.s -o conftest-filds-fists.o -arch
x86_64
Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: x86_64-apple-darwin22.1.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
 "/Library/Developer/CommandLineTools/usr/bin/clang" -cc1as -triple
x86_64-apple-macosx13.0.0 -filetype obj -main-file-name conftest-filds-fists.s
-target-cpu penryn
-fdebug-compilation-dir=/Volumes/Miscellaneous1/x86_64/gcc-13-20221120/gcc
-dwarf-debug-producer "Apple clang version 14.0.0 (clang-1400.0.29.202)"
-dwarf-version=4 -mrelocation-model pic --mrelax-relocations -mllvm
-disable-aligned-alloc-awareness=1 -o conftest-filds-fists.o
conftest-filds-fists.s

========================

I think the solution to this PR might be to set it as INVALID or WONTFIX? up to
you.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/107860] Compilation failure, ambiguous fisttp
  2022-11-24 16:45 [Bug bootstrap/107860] New: Compilation failure, ambiguous fisttp simon at pushface dot org
                   ` (6 preceding siblings ...)
  2022-11-25 14:02 ` simon at pushface dot org
@ 2022-11-25 14:08 ` pinskia at gcc dot gnu.org
  2022-12-05 23:34 ` pinskia at gcc dot gnu.org
  2023-07-05 13:34 ` simon at pushface dot org
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-25 14:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107860

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The same issue you would run into even on Linux with qemu and gnu as (though
gcc does not add the right target options to as as it assumes you have one that
targets your target by default.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/107860] Compilation failure, ambiguous fisttp
  2022-11-24 16:45 [Bug bootstrap/107860] New: Compilation failure, ambiguous fisttp simon at pushface dot org
                   ` (7 preceding siblings ...)
  2022-11-25 14:08 ` pinskia at gcc dot gnu.org
@ 2022-12-05 23:34 ` pinskia at gcc dot gnu.org
  2023-07-05 13:34 ` simon at pushface dot org
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-12-05 23:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107860

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
You need to do "arch -x86_64 bash" to this build really.
Otherwise you end up with the arm64 assembler.
So if you start with that, it should work.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/107860] Compilation failure, ambiguous fisttp
  2022-11-24 16:45 [Bug bootstrap/107860] New: Compilation failure, ambiguous fisttp simon at pushface dot org
                   ` (8 preceding siblings ...)
  2022-12-05 23:34 ` pinskia at gcc dot gnu.org
@ 2023-07-05 13:34 ` simon at pushface dot org
  9 siblings, 0 replies; 11+ messages in thread
From: simon at pushface dot org @ 2023-07-05 13:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107860

--- Comment #9 from simon at pushface dot org ---
(In reply to Andrew Pinski from comment #8)
> You need to do "arch -x86_64 bash" to this build really.
> Otherwise you end up with the arm64 assembler.
> So if you start with that, it should work.

Exactly so.

I don't think I completely understood your point at the time, sorry about that,
but today I verified it!

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-07-05 13:34 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-24 16:45 [Bug bootstrap/107860] New: Compilation failure, ambiguous fisttp simon at pushface dot org
2022-11-24 17:05 ` [Bug target/107860] " pinskia at gcc dot gnu.org
2022-11-24 17:06 ` pinskia at gcc dot gnu.org
2022-11-24 17:35 ` simon at pushface dot org
2022-11-24 17:41 ` simon at pushface dot org
2022-11-24 17:45 ` pinskia at gcc dot gnu.org
2022-11-24 17:46 ` pinskia at gcc dot gnu.org
2022-11-25 14:02 ` simon at pushface dot org
2022-11-25 14:08 ` pinskia at gcc dot gnu.org
2022-12-05 23:34 ` pinskia at gcc dot gnu.org
2023-07-05 13:34 ` simon at pushface dot 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).