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

[ASAN] awt_LoadLibrary.c reported compile warning ignoring return value of function by clang17

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 25
    • 24, 25
    • client-libs
    • 24
    • b03
    • generic
    • linux

      File src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c reported compile warning "ignoring return value of function" by clang17 with fastdebug configure.

      Configure command:
      bash configure --with-jobs=128 --prefix=/home/yansendao/git/jdk/install-fastdebug --verbose --with-debug-level=fastdebug --enable-unlimited-crypto --with-vendor-name=yansendao --with-vendor-url=https://github.com/sendaoYan --with-vendor-bug-url=mailto:yansendao.ysd@alibaba-inc.com --with-vendor-vm-bug-url=mailto:yansendao.ysd@alibaba-inc.com --with-jvm-variants=server --with-boot-jdk=/home/yansendao/software/jdk/24/jdk-repo-binary --with-gtest=/home/yansendao/git/googletest-v1.14.x --with-jtreg=/home/yansendao/software/jdk/jtreg-7.4 --with-jmh=build/jmh/jars --with-version-opt=f88c1c6f --with-zlib=system --enable-ccache --with-native-debug-symbols=external --with-toolchain-type=clang --with-toolchain-path=~/software/acc/x86_64/bin

      Standalone compile command:
      clang -MMD -MF build/linux-x86_64-server-fastdebug/support/native/java.desktop/libawt/awt_LoadLibrary.d.tmp -fpch-preprocess -pipe -fvisibility=hidden -DLIBC=gnu -D_GNU_SOURCE -D_REENTRANT -D_FILE_OFFSET_BITS=64 -DLINUX -DDEBUG -Wall -Wextra -Wformat=2 -Wpointer-arith -Wsign-compare -Wreorder -Wunused-function -Wundef -Wunused-value -Woverloaded-virtual -g -gdwarf-4 -gdwarf-aranges -std=c11 -fno-strict-aliasing -m64 -D_LITTLE_ENDIAN -DARCH='"amd64"' -Damd64 -D_LP64=1 -fno-omit-frame-pointer -fPIC -D__MEDIALIB_OLD_NAMES -D__USE_J2D_NAMES -DMLIB_NO_LIBSUNMATH -Isrc/java.desktop/unix/native/libawt -Isrc/java.desktop/share/native/libawt -Isrc/java.desktop/share/native/common/awt/debug -Isrc/java.desktop/unix/native/common/awt -Ibuild/linux-x86_64-server-fastdebug/support/headers/java.desktop -Isrc/java.desktop/unix/native/common/awt/utility -Isrc/java.desktop/share/native/common/awt/utility -Isrc/java.desktop/share/native/libawt/awt/image -Isrc/java.desktop/share/native/libawt/awt/image/cvutils -Isrc/java.desktop/unix/native/libawt/java2d -Isrc/java.desktop/share/native/libawt/java2d -Isrc/java.desktop/share/native/libawt/java2d/loops -Isrc/java.desktop/share/native/libawt/java2d/pipe -Ibuild/linux-x86_64-server-fastdebug/support/headers/java.base -Isrc/java.desktop/share/native/libawt/awt/medialib -Isrc/java.desktop/share/native/common/awt/medialib -Isrc/java.desktop/share/native/libmlib_image -Isrc/java.desktop/unix/native/include -Isrc/java.desktop/share/native/include -Isrc/java.base/linux/native/libjava -Isrc/java.base/unix/native/libjava -Isrc/java.base/share/native/libjava -Isrc/hotspot/share/include -Isrc/hotspot/os/posix/include -Ibuild/linux-x86_64-server-fastdebug/support/modules_include/java.base -Isrc/java.base/unix/native/include -Isrc/java.base/share/native/include -g -gdwarf-4 -gdwarf-aranges -Wno-unknown-warning-option -Wno-unused-parameter -Wno-unused-but-set-variable -Wno-unused-variable -Werror -O3 -D_FORTIFY_SOURCE=2 -c -o build/linux-x86_64-server-fastdebug/support/native/java.desktop/libawt/awt_LoadLibrary.o src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c -frandom-seed="awt_LoadLibrary.c"

      Clang17 compile output:
      src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c:140:9: error: ignoring return value of function declared with 'warn_unused_result' attribute [-Werror,-Wunused-result]
        140 | realpath((char *)dlinfo.dli_fname, buf);
            | ^~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      1 error generated.

      Clang version:
      clang version 17.0.6 (Alibaba Cloud Compiler 17.0.6.1-24.05.10.alios7)
      Target: x86_64-unknown-linux-gnu
      Thread model: posix
      InstalledDir: /home/yansendao/software/acc/x86_64/bin
      Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/10
      Selected GCC installation: /usr/lib/gcc/x86_64-redhat-linux/10
      Candidate multilib: .;@m64
      Selected multilib: .;@m64

            syan Sendao Yan
            syan Sendao Yan
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: