public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug driver/112759] New: [13 regression] mips -march=native detection broken with gcc 13+
@ 2023-11-29  7:10 matoro_gcc_bugzilla at matoro dot tk
  2023-11-29  7:10 ` [Bug driver/112759] " matoro_gcc_bugzilla at matoro dot tk
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: matoro_gcc_bugzilla at matoro dot tk @ 2023-11-29  7:10 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112759
           Summary: [13 regression] mips -march=native detection broken
                    with gcc 13+
           Product: gcc
           Version: 13.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: driver
          Assignee: unassigned at gcc dot gnu.org
          Reporter: matoro_gcc_bugzilla at matoro dot tk
  Target Milestone: ---

Since gcc 13 - and presumably 66c48be23e0fa5ee7474b4b078e013f901c71eed since
that is the only recent change to this area - detection of -march=native on
mips is broken, defaulting to mips1.

With gcc 13:
# gcc -march=native -Q --help=target | grep "arch=" | head -n 1
  -march=ISA                            mips1
# gcc --version
gcc (Gentoo 13.2.1_p20231014 p9) 13.2.1 20231014

With gcc 12:
# gcc -march=native -Q --help=target | grep "arch=" | head -n 1
  -march=ISA                            octeon2
# gcc --version
gcc (Gentoo 12.3.1_p20230825 p2) 12.3.1 20230825

Contents of my /proc/cpuinfo are attached.  strace seems to indicate that it is
reading the data at least:

openat(AT_FDCWD, "/proc/cpuinfo", O_RDONLY) = 3
statx(3, "", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT|AT_EMPTY_PATH,
STATX_BASIC_STATS, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0,
stx_mode=S_IFREG|0444, stx_size=0, ...}) = 0
read(3, "system type\t\t: EBB6800 (CN6880p2"..., 1024) = 1024
close(3)                                = 0

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

* [Bug driver/112759] [13 regression] mips -march=native detection broken with gcc 13+
  2023-11-29  7:10 [Bug driver/112759] New: [13 regression] mips -march=native detection broken with gcc 13+ matoro_gcc_bugzilla at matoro dot tk
@ 2023-11-29  7:10 ` matoro_gcc_bugzilla at matoro dot tk
  2023-11-29 22:16 ` [Bug driver/112759] [13/14 " pinskia at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: matoro_gcc_bugzilla at matoro dot tk @ 2023-11-29  7:10 UTC (permalink / raw)
  To: gcc-bugs

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

matoro <matoro_gcc_bugzilla at matoro dot tk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |matoro_gcc_bugzilla@matoro.
                   |                            |tk

--- Comment #1 from matoro <matoro_gcc_bugzilla at matoro dot tk> ---
Created attachment 56714
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56714&action=edit
/proc/cpuinfo

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

* [Bug driver/112759] [13/14 regression] mips -march=native detection broken with gcc 13+
  2023-11-29  7:10 [Bug driver/112759] New: [13 regression] mips -march=native detection broken with gcc 13+ matoro_gcc_bugzilla at matoro dot tk
  2023-11-29  7:10 ` [Bug driver/112759] " matoro_gcc_bugzilla at matoro dot tk
@ 2023-11-29 22:16 ` pinskia at gcc dot gnu.org
  2023-11-30  8:42 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-29 22:16 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[13 regression] mips        |[13/14 regression] mips
                   |-march=native detection     |-march=native detection
                   |broken with gcc 13+         |broken with gcc 13+

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Hmm, looks like it is this part of the change:
+  if (cpu)
+    ret = reconcat (ret, ret, "-m", argv[0], "=", cpu, NULL);

-  return concat ("-m", argv[0], "=", cpu, NULL);


Maybe it should have been:
```
if (cpu)
  {
    if (!ret)
      ret = concat ("-m", argv[0], "=", cpu, NULL);
    else
      ret = reconcat (ret, ret, "-m", argv[0], "=", cpu, NULL);
  }
```

Can you try that?

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

* [Bug driver/112759] [13/14 regression] mips -march=native detection broken with gcc 13+
  2023-11-29  7:10 [Bug driver/112759] New: [13 regression] mips -march=native detection broken with gcc 13+ matoro_gcc_bugzilla at matoro dot tk
  2023-11-29  7:10 ` [Bug driver/112759] " matoro_gcc_bugzilla at matoro dot tk
  2023-11-29 22:16 ` [Bug driver/112759] [13/14 " pinskia at gcc dot gnu.org
@ 2023-11-30  8:42 ` rguenth at gcc dot gnu.org
  2023-11-30 15:37 ` matoro_gcc_bugzilla at matoro dot tk
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-11-30  8:42 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |13.3

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

* [Bug driver/112759] [13/14 regression] mips -march=native detection broken with gcc 13+
  2023-11-29  7:10 [Bug driver/112759] New: [13 regression] mips -march=native detection broken with gcc 13+ matoro_gcc_bugzilla at matoro dot tk
                   ` (2 preceding siblings ...)
  2023-11-30  8:42 ` rguenth at gcc dot gnu.org
@ 2023-11-30 15:37 ` matoro_gcc_bugzilla at matoro dot tk
  2023-12-13  0:47 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: matoro_gcc_bugzilla at matoro dot tk @ 2023-11-30 15:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from matoro <matoro_gcc_bugzilla at matoro dot tk> ---
(In reply to Andrew Pinski from comment #2)
> Hmm, looks like it is this part of the change:
> +  if (cpu)
> +    ret = reconcat (ret, ret, "-m", argv[0], "=", cpu, NULL);
>  
> -  return concat ("-m", argv[0], "=", cpu, NULL);
> 
> 
> Maybe it should have been:
> ```
> if (cpu)
>   {
>     if (!ret)
>       ret = concat ("-m", argv[0], "=", cpu, NULL);
>     else
>       ret = reconcat (ret, ret, "-m", argv[0], "=", cpu, NULL);
>   }
> ```
> 
> Can you try that?

Indeed fixes it, thanks!

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

* [Bug driver/112759] [13/14 regression] mips -march=native detection broken with gcc 13+
  2023-11-29  7:10 [Bug driver/112759] New: [13 regression] mips -march=native detection broken with gcc 13+ matoro_gcc_bugzilla at matoro dot tk
                   ` (3 preceding siblings ...)
  2023-11-30 15:37 ` matoro_gcc_bugzilla at matoro dot tk
@ 2023-12-13  0:47 ` pinskia at gcc dot gnu.org
  2023-12-18  2:24 ` [Bug driver/112759] [13/14 regression] mips -march=native detection broken with gcc 13+ since r13-3178-g66c48be23e0fa5 syq at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-12-13  0:47 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2023-12-13

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

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

* [Bug driver/112759] [13/14 regression] mips -march=native detection broken with gcc 13+ since r13-3178-g66c48be23e0fa5
  2023-11-29  7:10 [Bug driver/112759] New: [13 regression] mips -march=native detection broken with gcc 13+ matoro_gcc_bugzilla at matoro dot tk
                   ` (4 preceding siblings ...)
  2023-12-13  0:47 ` pinskia at gcc dot gnu.org
@ 2023-12-18  2:24 ` syq at gcc dot gnu.org
  2023-12-18  3:16 ` syq at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: syq at gcc dot gnu.org @ 2023-12-18  2:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from YunQiang Su <syq at gcc dot gnu.org> ---
It's my fault.
I misunderstanding `reconcat`:

if `optr` is NULL, it cannot work as the `s1` at the sametime.
If so, the return string will be empty.

So, let's define and initial ret like this:

char *ret = concat(" "); 

Any idea?

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

* [Bug driver/112759] [13/14 regression] mips -march=native detection broken with gcc 13+ since r13-3178-g66c48be23e0fa5
  2023-11-29  7:10 [Bug driver/112759] New: [13 regression] mips -march=native detection broken with gcc 13+ matoro_gcc_bugzilla at matoro dot tk
                   ` (5 preceding siblings ...)
  2023-12-18  2:24 ` [Bug driver/112759] [13/14 regression] mips -march=native detection broken with gcc 13+ since r13-3178-g66c48be23e0fa5 syq at gcc dot gnu.org
@ 2023-12-18  3:16 ` syq at gcc dot gnu.org
  2023-12-23  8:47 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: syq at gcc dot gnu.org @ 2023-12-18  3:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from YunQiang Su <syq at gcc dot gnu.org> ---
ohh, it should be concat(" ", NULL);

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

* [Bug driver/112759] [13/14 regression] mips -march=native detection broken with gcc 13+ since r13-3178-g66c48be23e0fa5
  2023-11-29  7:10 [Bug driver/112759] New: [13 regression] mips -march=native detection broken with gcc 13+ matoro_gcc_bugzilla at matoro dot tk
                   ` (6 preceding siblings ...)
  2023-12-18  3:16 ` syq at gcc dot gnu.org
@ 2023-12-23  8:47 ` cvs-commit at gcc dot gnu.org
  2023-12-23  8:51 ` cvs-commit at gcc dot gnu.org
  2023-12-23  8:55 ` syq at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-23  8:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by YunQiang Su <syq@gcc.gnu.org>:

https://gcc.gnu.org/g:384dbb0b4e751e6eb7ba3f9993a6cce466743926

commit r14-6811-g384dbb0b4e751e6eb7ba3f9993a6cce466743926
Author: YunQiang Su <syq@gcc.gnu.org>
Date:   Tue Dec 19 07:36:52 2023 +0800

    MIPS: Put the ret to the end of args of reconcat [PR112759]

    The function `reconcat` cannot append string(s) to NULL,
    as the concat process will stop at the first NULL.

    Let's always put the `ret` to the end, as it may be NULL.
    We keep use reconcat here, due to that reconcat can make it
    easier if we add more hardware features detecting, for example
    by hwcap.

    gcc/

            PR target/112759
            * config/mips/driver-native.cc (host_detect_local_cpu):
            Put the ret to the end of args of reconcat.

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

* [Bug driver/112759] [13/14 regression] mips -march=native detection broken with gcc 13+ since r13-3178-g66c48be23e0fa5
  2023-11-29  7:10 [Bug driver/112759] New: [13 regression] mips -march=native detection broken with gcc 13+ matoro_gcc_bugzilla at matoro dot tk
                   ` (7 preceding siblings ...)
  2023-12-23  8:47 ` cvs-commit at gcc dot gnu.org
@ 2023-12-23  8:51 ` cvs-commit at gcc dot gnu.org
  2023-12-23  8:55 ` syq at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-23  8:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by YunQiang Su <syq@gcc.gnu.org>:

https://gcc.gnu.org/g:63df799074351e9b3ab90f5b3031ba2691385af8

commit r13-8175-g63df799074351e9b3ab90f5b3031ba2691385af8
Author: YunQiang Su <syq@gcc.gnu.org>
Date:   Tue Dec 19 07:36:52 2023 +0800

    MIPS: Put the ret to the end of args of reconcat [PR112759]

    The function `reconcat` cannot append string(s) to NULL,
    as the concat process will stop at the first NULL.

    Let's always put the `ret` to the end, as it may be NULL.
    We keep use reconcat here, due to that reconcat can make it
    easier if we add more hardware features detecting, for example
    by hwcap.

    gcc/

            PR target/112759
            * config/mips/driver-native.cc (host_detect_local_cpu):
            Put the ret to the end of args of reconcat.

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

* [Bug driver/112759] [13/14 regression] mips -march=native detection broken with gcc 13+ since r13-3178-g66c48be23e0fa5
  2023-11-29  7:10 [Bug driver/112759] New: [13 regression] mips -march=native detection broken with gcc 13+ matoro_gcc_bugzilla at matoro dot tk
                   ` (8 preceding siblings ...)
  2023-12-23  8:51 ` cvs-commit at gcc dot gnu.org
@ 2023-12-23  8:55 ` syq at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: syq at gcc dot gnu.org @ 2023-12-23  8:55 UTC (permalink / raw)
  To: gcc-bugs

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

YunQiang Su <syq at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #9 from YunQiang Su <syq at gcc dot gnu.org> ---
It should be fixed now, and back ported to gcc13.

And we may should add some more detections:

1. hwcap
2. getauxval(AT_PLATFORM)
3. more cpuinfo parsing

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

end of thread, other threads:[~2023-12-23  8:55 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-29  7:10 [Bug driver/112759] New: [13 regression] mips -march=native detection broken with gcc 13+ matoro_gcc_bugzilla at matoro dot tk
2023-11-29  7:10 ` [Bug driver/112759] " matoro_gcc_bugzilla at matoro dot tk
2023-11-29 22:16 ` [Bug driver/112759] [13/14 " pinskia at gcc dot gnu.org
2023-11-30  8:42 ` rguenth at gcc dot gnu.org
2023-11-30 15:37 ` matoro_gcc_bugzilla at matoro dot tk
2023-12-13  0:47 ` pinskia at gcc dot gnu.org
2023-12-18  2:24 ` [Bug driver/112759] [13/14 regression] mips -march=native detection broken with gcc 13+ since r13-3178-g66c48be23e0fa5 syq at gcc dot gnu.org
2023-12-18  3:16 ` syq at gcc dot gnu.org
2023-12-23  8:47 ` cvs-commit at gcc dot gnu.org
2023-12-23  8:51 ` cvs-commit at gcc dot gnu.org
2023-12-23  8:55 ` syq at gcc dot gnu.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).