[clang] [llvm] [DebugInfo] Emit DW_AT_const_value for constexpr array static members (PR #182442)

Nikita Popov via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 5 06:04:05 PST 2026


nikic wrote:

This causes test failures on big endian:
```
******************** TEST 'LLVM :: DebugInfo/X86/debug-info-constexpr-array.ll' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
/builddir/build/BUILD/llvm-project-c32caeec8158d634bb71ab8911a6031248b9fc47/llvm/redhat-linux-build/bin/llc -mtriple=x86_64-linux-gnu -filetype=obj /builddir/build/BUILD/llvm-project-c32caeec8158d634bb71ab8911a6031248b9fc47/llvm/test/DebugInfo/X86/debug-info-constexpr-array.ll -o /builddir/build/BUILD/llvm-project-c32caeec8158d634bb71ab8911a6031248b9fc47/llvm/redhat-linux-build/test/DebugInfo/X86/Output/debug-info-constexpr-array.ll.tmp
# executed command: /builddir/build/BUILD/llvm-project-c32caeec8158d634bb71ab8911a6031248b9fc47/llvm/redhat-linux-build/bin/llc -mtriple=x86_64-linux-gnu -filetype=obj /builddir/build/BUILD/llvm-project-c32caeec8158d634bb71ab8911a6031248b9fc47/llvm/test/DebugInfo/X86/debug-info-constexpr-array.ll -o /builddir/build/BUILD/llvm-project-c32caeec8158d634bb71ab8911a6031248b9fc47/llvm/redhat-linux-build/test/DebugInfo/X86/Output/debug-info-constexpr-array.ll.tmp
# note: command had no output on stdout or stderr
# RUN: at line 2
/builddir/build/BUILD/llvm-project-c32caeec8158d634bb71ab8911a6031248b9fc47/llvm/redhat-linux-build/bin/llvm-dwarfdump --debug-info /builddir/build/BUILD/llvm-project-c32caeec8158d634bb71ab8911a6031248b9fc47/llvm/redhat-linux-build/test/DebugInfo/X86/Output/debug-info-constexpr-array.ll.tmp | /builddir/build/BUILD/llvm-project-c32caeec8158d634bb71ab8911a6031248b9fc47/llvm/redhat-linux-build/bin/FileCheck /builddir/build/BUILD/llvm-project-c32caeec8158d634bb71ab8911a6031248b9fc47/llvm/test/DebugInfo/X86/debug-info-constexpr-array.ll
# executed command: /builddir/build/BUILD/llvm-project-c32caeec8158d634bb71ab8911a6031248b9fc47/llvm/redhat-linux-build/bin/llvm-dwarfdump --debug-info /builddir/build/BUILD/llvm-project-c32caeec8158d634bb71ab8911a6031248b9fc47/llvm/redhat-linux-build/test/DebugInfo/X86/Output/debug-info-constexpr-array.ll.tmp
# note: command had no output on stdout or stderr
# executed command: /builddir/build/BUILD/llvm-project-c32caeec8158d634bb71ab8911a6031248b9fc47/llvm/redhat-linux-build/bin/FileCheck /builddir/build/BUILD/llvm-project-c32caeec8158d634bb71ab8911a6031248b9fc47/llvm/test/DebugInfo/X86/debug-info-constexpr-array.ll
# .---command stderr------------
# | /builddir/build/BUILD/llvm-project-c32caeec8158d634bb71ab8911a6031248b9fc47/llvm/test/DebugInfo/X86/debug-info-constexpr-array.ll:34:10: error: CHECK: expected string not found in input
# | ; CHECK: DW_AT_const_value (<0x0c> 01 00 00 00 02 00 00 00 03 00 00 00 )
# |          ^
# | <stdin>:47:21: note: scanning from here
# |  DW_AT_name ("NUMS")
# |                     ^
# | <stdin>:53:2: note: possible intended match here
# |  DW_AT_const_value (<0x0c> 00 00 00 01 00 00 00 02 00 00 00 03 )
# |  ^
# | 
# | Input file: <stdin>
# | Check file: /builddir/build/BUILD/llvm-project-c32caeec8158d634bb71ab8911a6031248b9fc47/llvm/test/DebugInfo/X86/debug-info-constexpr-array.ll
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             .
# |             .
# |             .
# |            42:  DW_AT_external (true) 
# |            43:  DW_AT_declaration (true) 
# |            44:  DW_AT_const_value (<0x06> 48 65 6c 6c 6f 00 ) 
# |            45:  
# |            46: 0x00000071: DW_TAG_member 
# |            47:  DW_AT_name ("NUMS") 
# | check:34'0                         X error: no match found
# |            48:  DW_AT_type (0x0000012f "const int[3]") 
# | check:34'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            49:  DW_AT_decl_file ("/tmp/test.cpp") 
# | check:34'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            50:  DW_AT_decl_line (10) 
# | check:34'0     ~~~~~~~~~~~~~~~~~~~~~~
# |            51:  DW_AT_external (true) 
# | check:34'0     ~~~~~~~~~~~~~~~~~~~~~~~
# |            52:  DW_AT_declaration (true) 
# | check:34'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            53:  DW_AT_const_value (<0x0c> 00 00 00 01 00 00 00 02 00 00 00 03 ) 
# | check:34'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | check:34'1      ?                                                                possible intended match
# |            54:  
# | check:34'0     ~
# |            55: 0x00000089: DW_TAG_member 
# | check:34'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            56:  DW_AT_name ("SHORTS") 
# | check:34'0     ~~~~~~~~~~~~~~~~~~~~~~~
# |            57:  DW_AT_type (0x00000147 "const uint16_t[3]") 
# | check:34'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            58:  DW_AT_decl_file ("/tmp/test.cpp") 
# | check:34'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             .
# |             .
# |             .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

********************
```

https://github.com/llvm/llvm-project/pull/182442


More information about the cfe-commits mailing list