Bug 23294 - Complex _FloatN functions are redirected to the wrong function with -mlong-double-64
Summary: Complex _FloatN functions are redirected to the wrong function with -mlong-do...
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: math (show other bugs)
Version: 2.28
: P2 normal
Target Milestone: 2.32
Assignee: Tulio Magno Quites Machado Filho
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-06-15 13:12 UTC by Tulio Magno Quites Machado Filho
Modified: 2020-02-21 14:51 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tulio Magno Quites Machado Filho 2018-06-15 13:12:44 UTC
I reproduced this issue with math/test-ldouble-finite-acos.
I replaced -mlong-double-128 with -mlong-double-64.

The preprocessor generates:

extern _Complex _Float32 cacosf32 (_Complex _Float32 __z) __asm__ ("" "cacos") __attribute__ ((__nothrow__ , __leaf__)); extern _Complex _Float32 __cacosf32 (_Complex _Float32 __z) __asm__ ("" "__cacos") __attribute__ ((__nothrow__ , __leaf__));

All complex _FloatN are redirected, even when they have their own symbols.
Comment 1 jsm-csl@polyomino.org.uk 2018-06-15 16:19:59 UTC
I think this applies to the real functions in math.h as well - they have 
the same issue of __MATHDECL_1 being redefined for long double 
redirection, but not restored to its original version for _FloatN.  (The 
code for declaring narrowing functions, however, takes care to restore the 
original __MATHCALL_NARROW definition if it's changed to declare long 
double functions.)
Comment 2 Tulio Magno Quites Machado Filho 2018-06-15 17:53:09 UTC
(In reply to joseph@codesourcery.com from comment #1)
> I think this applies to the real functions in math.h as well - they have 
> the same issue of __MATHDECL_1 being redefined for long double 
> redirection, but not restored to its original version for _FloatN.  (The 
> code for declaring narrowing functions, however, takes care to restore the 
> original __MATHCALL_NARROW definition if it's changed to declare long 
> double functions.)

Confirmed:

extern _Float32 acosf32 (_Float32 __x) __asm__ ("" "__acosf_finite") __attribute__ ((__nothrow__ , __leaf__));
Comment 3 Tulio Magno Quites Machado Filho 2018-06-15 17:55:20 UTC
(In reply to Tulio Magno Quites Machado Filho from comment #2)

> Confirmed:
> 
> extern _Float32 acosf32 (_Float32 __x) __asm__ ("" "__acosf_finite")
> __attribute__ ((__nothrow__ , __leaf__));

That's a pasto.

I meant to paste this:

extern _Float32 acosf32 (_Float32 __x) __asm__ ("" "acos") __attribute__ ((__nothrow__ , __leaf__));
Comment 4 Sourceware Commits 2020-02-21 14:28:54 UTC
The master branch has been updated by Paul E. Murphy <murphyp@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=77ad97356caacfa5a54236791c4f1f68b689e915

commit 77ad97356caacfa5a54236791c4f1f68b689e915
Author: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
Date:   Mon Jun 18 21:11:26 2018 -0300

    Undefine redirections after long double definition on __LDBL_COMPAT [BZ #23294]
    
    After defining the long double redirections to double, __MATHDECL_1 has
    to be redefined to its previous state in order to avoid redirecting all
    subsequent types.
Comment 5 Paul E. Murphy 2020-02-21 14:51:20 UTC
Fixed via commit noted earlier.