Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frigg assert / illegal instruction while running configure #1098

Open
Dennisbonke opened this issue Aug 1, 2024 · 1 comment
Open

Frigg assert / illegal instruction while running configure #1098

Dennisbonke opened this issue Aug 1, 2024 · 1 comment
Labels
bug This issue reports a bug

Comments

@Dennisbonke
Copy link
Member

While running configure in GNU sed, for the checking for working nanosleep check, an illegal instruction is triggered. IP points to libc.so, and addr2line gives /var/lib/managarm-buildenv/build/system-root/usr/share/frigg/include/frg/mutex.hpp:62 (discriminator 3) (source code here).

@Dennisbonke Dennisbonke added the bug This issue reports a bug label Aug 1, 2024
@Dennisbonke Dennisbonke moved this to To do for proper self-hosting (including image generation) in Self-hosting Aug 2, 2024
@Dennisbonke
Copy link
Member Author

One of the tests that consistently reproduces this is the following code snippet

#include <float.h>
#include <math.h>
#include <string.h>
#if HAVE_DECL_ALARM
# include <signal.h>
# include <unistd.h>
#endif
/* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0.
   ICC 10.0 has a bug when optimizing the expression -zero.
   The expression -DBL_MIN * DBL_MIN does not work when cross-compiling
   to PowerPC on Mac OS X 10.5.  */
#if defined __hpux || defined __sgi || defined __ICC
static double
compute_minus_zero (void)
{
  return -DBL_MIN * DBL_MIN;
}
# define minus_zero compute_minus_zero ()
#else
double minus_zero = -0.0;
#endif
int main()
{
  int result = 0;
  int i;
  volatile double x;
  double zero = 0.0;
#if HAVE_DECL_ALARM
  /* NeXTstep 3.3 frexp() runs into an endless loop when called on an infinite
     number.  Let the test fail in this case.  */
  signal (SIGALRM, SIG_DFL);
  alarm (5);
#endif
  /* Test on denormalized numbers.  */
  for (i = 1, x = 1.0; i >= DBL_MIN_EXP; i--, x *= 0.5)
    ;
  if (x > 0.0)
    {
      int exp;
      double y = frexp (x, &exp);
      /* On machines with IEEE754 arithmetic: x = 1.11254e-308, exp = -1022.
         On NetBSD: y = 0.75. Correct: y = 0.5.  */
      if (y != 0.5)
        result |= 1;
    }
  /* Test on infinite numbers.  */
  x = 1.0 / zero;
  {
    int exp;
    double y = frexp (x, &exp);
    if (y != x)
      result |= 2;
  }
  /* Test on negative zero.  */
  x = minus_zero;
  {
    int exp;
    double y = frexp (x, &exp);
    if (memcmp (&y, &x, sizeof x))
      result |= 4;
  }
  return result;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue reports a bug
Projects
Status: To do for proper self-hosting (including image generation)
Development

No branches or pull requests

1 participant