Bug 13920 - tgammal (-LDBL_MAX) raises spurious overflow exception
Summary: tgammal (-LDBL_MAX) raises spurious overflow exception
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: math (show other bugs)
Version: 2.15
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-27 23:41 UTC by Joseph Myers
Modified: 2014-06-26 13:39 UTC (History)
0 users

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 Joseph Myers 2012-03-27 23:41:46 UTC
tgammal (-LDBL_MAX) raises spurious a overflow exception (in addition to a correct INVALID exception); tested x86.  Testcase:

#include <errno.h>
#include <fenv.h>
#include <math.h>
#include <stdio.h>
#include <float.h>

volatile long double d = -LDBL_MAX;

int
main (void)
{
  feclearexcept (FE_ALL_EXCEPT);
  errno = 0;
  volatile long double r = tgammal (d);
  if (fetestexcept (FE_DIVBYZERO))
    printf ("DIVBYZERO ");
  if (fetestexcept (FE_INEXACT))
    printf ("INEXACT ");
  if (fetestexcept (FE_INVALID))
    printf ("INVALID ");
  if (fetestexcept (FE_OVERFLOW))
    printf ("OVERFLOW ");
  if (fetestexcept (FE_UNDERFLOW))
    printf ("UNDERFLOW ");
  printf ("%.18Lg %m\n", r);
  return 0;
}
Comment 1 Joseph Myers 2012-03-28 09:39:44 UTC
Fixed by:

commit 41bf21a1e72c907b1a065727c3b5da43821ca6b0
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Wed Mar 28 09:32:12 2012 +0000

    Avoid overflows from long double functions using __kernel_standard.