Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8223489

_Atomic types can cause StackOverflowError

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • repo-panama
    • None
    • tools
    • None

      If a header file contains _Atomic types, for example, given the following,

      typedef unsigned long ulong_t;
      struct SomeTypes {
          _Atomic ulong_t aul;
          volatile unsigned int vui;
      };

      The _Atomic type will cause StackOverflowError as following stack trace.

      The cause is that _Atomic types are unexposed in libclang, and the canonicalType give back the same type, thus cause an infinite recursion.

      Exception in thread "main" java.lang.StackOverflowError
      at java.base/java.nio.ByteBuffer.limit(ByteBuffer.java:1313)
      at java.base/java.nio.MappedByteBuffer.limit(MappedByteBuffer.java:235)
      at java.base/java.nio.MappedByteBuffer.limit(MappedByteBuffer.java:67)
      at java.base/java.nio.Buffer.<init>(Buffer.java:223)
      at java.base/java.nio.ByteBuffer.<init>(ByteBuffer.java:284)
      at java.base/java.nio.ByteBuffer.<init>(ByteBuffer.java:292)
      at java.base/java.nio.MappedByteBuffer.<init>(MappedByteBuffer.java:90)
      at java.base/java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:115)
      at java.base/java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:320)
      at jdk.internal.clang/jdk.internal.clang.StructType.<init>(StructType.java:37)
      at jdk.internal.clang/jdk.internal.clang.StructType.<init>(StructType.java:32)
      at jdk.internal.clang/jdk.internal.clang.Type.<init>(Type.java:30)
      at jdk.internal.clang/jdk.internal.clang.Type.canonicalType(Native Method)
      at jdk.jextract/com.sun.tools.jextract.TypeDictionary.getInternal(TypeDictionary.java:146)
      at jdk.jextract/com.sun.tools.jextract.TypeDictionary.getInternal(TypeDictionary.java:146)
      at jdk.jextract/com.sun.tools.jextract.TypeDictionary.getInternal(TypeDictionary.java:146)
      at jdk.jextract/com.sun.tools.jextract.TypeDictionary.getInternal(TypeDictionary.java:146)

            henryjen Henry Jen
            henryjen Henry Jen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: