Bug 100909 - [12 Regression] powerpc64le: Regression causing unexpected error with IBM long double
Summary: [12 Regression] powerpc64le: Regression causing unexpected error with IBM lon...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 12.0
: P3 normal
Target Milestone: 12.0
Assignee: Martin Liška
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2021-06-04 18:11 UTC by Tulio Magno Quites Machado Filho
Modified: 2021-08-13 09:42 UTC (History)
4 users (show)

See Also:
Host:
Target: powerpc64le-gnu-linux
Build:
Known to work:
Known to fail:
Last reconfirmed: 2021-06-04 00:00:00


Attachments
Pre-processed s_modff128-ifunc.c file from glibc (53.79 KB, text/plain)
2021-06-04 18:11 UTC, Tulio Magno Quites Machado Filho
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tulio Magno Quites Machado Filho 2021-06-04 18:11:43 UTC
Created attachment 50934 [details]
Pre-processed s_modff128-ifunc.c file from glibc

I've recently started seeing this regression while building glibc on powerpc64le:

gcc -m64 test.i -c -mlong-double-128   -mabi=ibmlongdouble
/home/tuliom/tmp/at-build-tray/at15.0-0-alpha.suse-15_ppc64le_ppc64le/builds/glibc_1-64/math/s_modff128-ifunc.c:8:1: error: ‘-mabi=ibmlongdouble’ requires ‘-mlong-double-128’
    8 | DECL_ALIAS_s_modf (modf);
      | ^~~~~~

Notice that both parameters are being passed to GCC.

I've bisected this issue to:

commit ebd5e86c0f41dc1d692f9b2b68a510b1f6835a3e
Author: Martin Liska <mliska@suse.cz>
Date:   Wed Mar 10 15:12:31 2021 +0100

    Improve global state for options.
    
    gcc/c-family/ChangeLog:
    
            PR tree-optimization/92860
            PR target/99592
            * c-attribs.c (handle_optimize_attribute): Save target node
            before calling parse_optimize_options and save it in case
            it changes.
            * c-pragma.c (handle_pragma_target): Similarly for pragma.
            (handle_pragma_pop_options): Likewise here.
    
    gcc/ChangeLog:
    
            PR tree-optimization/92860
            PR target/99592
            * optc-save-gen.awk: Remove exceptions.


I can still reproduce it with commit ee9548b36a7f.
Comment 1 Peter Bergner 2021-06-04 18:35:23 UTC
Confirmed.  creduce on the attached test case gives me:

bergner@pike:~/gcc/BUGS/PR100909$ cat pr100909.i
void __attribute__((__optimize__("O2"))) a() { }

bergner@pike:~/gcc/BUGS/PR100909$ /home/bergner/gcc/build/gcc-fsf-mainline-pr100799-debug/gcc/xgcc -B/home/bergner/gcc/build/gcc-fsf-mainline-pr100799-debug/gcc -S  -mlong-double-128 -mabi=ibmlongdouble pr100909.i 
pr100909.i:1:1: error: ‘-mabi=ibmlongdouble’ requires ‘-mlong-double-128’
    1 | void __attribute__((__optimize__("O2"))) a() { }
      | ^~~~
pr100909.i: In function ‘a’:
pr100909.i:1:1: error: ‘-mabi=ibmlongdouble’ requires ‘-mlong-double-128’
pr100909.i:1:1: error: ‘-mabi=ibmlongdouble’ requires ‘-mlong-double-128’
pr100909.i:1:42: error: ‘-mabi=ibmlongdouble’ requires ‘-mlong-double-128’
    1 | void __attribute__((__optimize__("O2"))) a() { }
      |                                          ^
pr100909.i:1:42: error: ‘-mabi=ibmlongdouble’ requires ‘-mlong-double-128’
Comment 2 Martin Liška 2021-06-06 15:50:44 UTC
Mine, I've got a patch for it.
Comment 3 Peter Bergner 2021-07-08 00:52:49 UTC
(In reply to Martin Liška from comment #2)
> Mine, I've got a patch for it.

Hi Martin, any status on how your patch worked out?
Comment 4 Martin Liška 2021-07-12 04:19:51 UTC
> Hi Martin, any status on how your patch worked out?

Hello. Waiting for Segher to reply and I've just pinged that right now.
Comment 5 Martin Liška 2021-08-13 09:42:15 UTC
It's fixed now since g:318113a961220c8da79d8d29619138827ccc69f1

commit 318113a961220c8da79d8d29619138827ccc69f1
Author: Martin Liska <mliska@suse.cz>
Date:   Tue Jun 1 15:39:14 2021 +0200

    rs6000: Fix restored rs6000_long_double_type_size
    
    As mentioned in the "Fallout: save/restore target options in handle_optimize_attribute"
    thread, we need to support target option restore
    of rs6000_long_double_type_size == FLOAT_PRECISION_TFmode.
    
    gcc/ChangeLog:
    
            * config/rs6000/rs6000.c (rs6000_option_override_internal): When
            a target option is restored, it can have
            rs6000_long_double_type_size set to FLOAT_PRECISION_TFmode
            and error should not be emitted.
    
    gcc/testsuite/ChangeLog:
    
            * gcc.target/powerpc/pragma-optimize.c: New test.