[Bug fortran/56659] Segfault due to missing libcpp error handler for "gfortran -cpp"

manu at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Sep 13 15:57:00 GMT 2015


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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu.org

--- Comment #2 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Tobias Burnus from comment #0)
> Reported by Paul Kapinos at fortran@gcc,
> http://thread.gmane.org/gmane.comp.gcc.fortran/40495
> http://gcc.gnu.org/ml/fortran/2013-03/msg00083.html
> 
> The problem is that libcpp calls an error handler, which is not set in f951.
> 
> 
> Namely,   pfile->cb.error == NULL  but should be point to a function; it has
> the the prototype:
>  bool (*)(cpp_reader *, int, int, source_location, unsigned int, const char
> *,
>           va_list *) 
> C/C++ use:
>    in c-opts.c: "cb->error = c_cpp_error;"
> the function is declared in c-family/c-common.c.

Now that Fortran uses the common diagnostics machinery, it should be possible
to either move this function to common code or create a duplicate in the
Fortran FE.

(Even better would be to convert the common diagnostics machinery to a library
and make libcpp depend on it, which will avoid all these conversions from/to
libcpp/FE enums since libcpp could use directly the same diagnostic enums as
the rest of the compiler)


More information about the Gcc-bugs mailing list