Integrated: 7903157: jextract crashes when header contains complex long double
Maurizio Cimadamore
mcimadamore at openjdk.java.net
Wed Apr 13 09:58:37 UTC 2022
On Tue, 12 Apr 2022 21:05:14 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
> Following the work in JDK-7903146, jextract crashes when encountering an header that contains a `long double complex`. As it turns out, this was a latent issue: the analysis in UnsupportedLayouts did not recursively follow a `DelegatedType`, unless its kind was a `typedef`.
>
> There were reasons as to why the recursion was restricted: following pointers blindly can lead to infinite recursion (A points to B which points back to A). Butpointers are never problematic in terms of layout: the layout of a pointer is always fixed (given a platform), independently of what the pointee actually is.
>
> So, the fix is for the analysis to be applied recursively to the delegated type, unless the type is a pointer type. This correctly detects `long double complex` (but also `atomic long double` etc.).
>
> I could not add a test because our test framework ensures that tests cannot rely on standard headers (by forcing the `-C-nostdinc` flag on clang). This is problematic, because it is not possible to use complex types in C w/o including `<complex.h>`, at least not in a portable fashion (on Windows, MSVC does not support the `_Complex` keyword defined in C99 [1]).
>
> [1] - https://docs.microsoft.com/en-us/cpp/c-runtime-library/complex-math-support?view=msvc-170
This pull request has now been integrated.
Changeset: 8f582d12
Author: Maurizio Cimadamore <mcimadamore at openjdk.org>
URL: https://git.openjdk.java.net/jextract/commit/8f582d121b42cc8321e529a6452be7e508bbdbf3
Stats: 4 lines in 1 file changed: 1 ins; 0 del; 3 mod
7903157: jextract crashes when header contains complex long double
Reviewed-by: sundar
-------------
PR: https://git.openjdk.java.net/jextract/pull/20
More information about the jextract-dev
mailing list