Bug 64534 - invalid -march value incosistency
Summary: invalid -march value incosistency
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: driver (show other bugs)
Version: unknown
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic
: 103421 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-01-08 08:21 UTC by Justin
Modified: 2023-12-11 02:51 UTC (History)
2 users (show)

See Also:
Host: x86_64-*-*, i?86-*-*
Target: x86_64-*-*, i?86-*-*
Build:
Known to work:
Known to fail: 4.9.2, 5.1.0, 6.0
Last reconfirmed: 2016-01-01 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Justin 2015-01-08 08:21:05 UTC
Overwriting invalid -march later in the command line has an inconsistency

Following works

gcc -march=no-automagic -march=core2
gcc -march=no-automagic -march=pentium-m

Following breaks

gcc -march=no-automagic -march=native


I would prefer that the build always breaks with 

error: bad value (no-automagic) for -march= switch

but we should at least have the same behavior for both cases.
Comment 1 Martin Sebor 2016-01-01 19:28:05 UTC
Confirmed:

$ echo | /home/msebor/build/gcc-trunk-svn/gcc/xgcc -B/home/msebor/build/gcc-trunk-svn/gcc -S -march=foobar -march=core2 -o/dev/null -xc -

$ echo | /home/msebor/build/gcc-trunk-svn/gcc/xgcc -B/home/msebor/build/gcc-trunk-svn/gcc -S -march=foobar -march=native -o/dev/null -xc -
<stdin>:1:0: error: bad value (foobar) for -march= switch

This seems to be due to the special treatment of -march=native by the i386 driver which forces it before any other -march= options, even if they are specified first on the command line.
Comment 2 Viktor Yu. Kovalskii 2019-11-16 01:41:57 UTC
(In reply to Martin Sebor from comment #1)
> Confirmed:
> 
> $ echo | /home/msebor/build/gcc-trunk-svn/gcc/xgcc
> -B/home/msebor/build/gcc-trunk-svn/gcc -S -march=foobar -march=core2
> -o/dev/null -xc -
> 
> $ echo | /home/msebor/build/gcc-trunk-svn/gcc/xgcc
> -B/home/msebor/build/gcc-trunk-svn/gcc -S -march=foobar -march=native
> -o/dev/null -xc -
> <stdin>:1:0: error: bad value (foobar) for -march= switch
> 
> This seems to be due to the special treatment of -march=native by the i386
> driver which forces it before any other -march= options, even if they are
> specified first on the command line.

Any progress?
Comment 3 Andrew Pinski 2021-12-29 06:32:08 UTC
*** Bug 103421 has been marked as a duplicate of this bug. ***