[PATCH] Small fix for tgmath.h
Richard Smith
richard at metafoo.co.uk
Fri Mar 29 14:23:34 PDT 2013
On Fri, Mar 29, 2013 at 1:51 PM, YunZhong Gao <gaoyunzhong at gmail.com> wrote:
> gaoyunzhong added you to the CC list for the revision "Small fix for
> tgmath.h".
>
> Hi,
>
> This patch attempts to fix the return types of the complex creal
> functions. They should return non-complex types according to C99 section
> 7.22c6 and 7.3.9.5. The fix is to remove the extra _Complex keywords from
> the prototypes of the creal functions in a similar manner as Kristof Beyls
> did to fabs a few weeks ago.
>
Yes, I agree this looks wrong.
> I am not sure where I can add a regression test for a header change like
> this.
Somewhere in test/Headers would be best.
> With the small test case below, GCC 4.4.3 returns 4 at run-time while
> Clang trunk r176911 returns 8.
>
> ``` /* test.c */
> #include <stdio.h>
> #include <tgmath.h>
>
> float f;
>
> int main() {
> printf("%lu\n", sizeof(creal(f)));
> return 0;
> }
> /* end of file */```
>
> Could someone review and commit the patch for me?
>
> Thanks, Gao.
>
> http://llvm-reviews.chandlerc.com/D595
>
> Files:
> lib/Headers/tgmath.h
>
> Index: lib/Headers/tgmath.h
> ===================================================================
> --- lib/Headers/tgmath.h
> +++ lib/Headers/tgmath.h
> @@ -1340,15 +1340,15 @@
>
> // creal
>
> -static float _Complex
> +static float
> _TG_ATTRS
> __tg_creal(float __x) {return __x;}
>
> -static double _Complex
> +static double
> _TG_ATTRS
> __tg_creal(double __x) {return __x;}
>
> -static long double _Complex
> +static long double
> _TG_ATTRS
> __tg_creal(long double __x) {return __x;}
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130329/c34dd55d/attachment.html>
More information about the cfe-commits
mailing list