https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67365

Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ian at airs dot com

--- Comment #2 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> ---
(In reply to Francois-Xavier Coudert from comment #1)
> Confirmed. This apparently has to do with FPE exceptions and signal
> handling, but I don' know how.

Confirmed, that address is related to signal handler. Even in a C program, I
see it in-between the handler (which, in libgfortran's case, we hide as a
private symbol) and the user-provided functions:

[fx@kelvin irun]$ cat a.c
#define _GNU_SOURCE
#include <fenv.h>
#include <stdio.h>
#include <signal.h>

extern void _gfortran_backtrace (void);

void handler (int sig)
{
  signal (SIGFPE, SIG_DFL);
  _gfortran_backtrace();
}

double bar (double x)
{
  return x / x;
}

int main (void)
{
  double x, y;

  feenableexcept (FE_INVALID | FE_DIVBYZERO);
  signal (SIGFPE, handler);
  x = 0;
  y = bar (x);
  printf ("%g\n", y);
}
[fx@kelvin irun]$ ./bin/gcc a.c -static -lgfortran -lquadmath -lm -g && ./a.out
#0  0x4010ce handler
        /home/fx/gcc/irun/a.c:11
#1  0x4306df ???
#2  0x4010e0 bar
        /home/fx/gcc/irun/a.c:16
#3  0x401122 main
        /home/fx/gcc/irun/a.c:26
Floating point exception (core dumped)


I'm not sure there is much we can do here. I am CC'ing Ian, who probably knows
best.

Reply via email to