<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/63921>63921</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            nondeterministic dwarfdump
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          fangism
      </td>
    </tr>
</table>

<pre>
    We've observed some local build nondeterminism in clang outputs.

The following command produces different .o outputs (with some non-zero probability).

```shell
$ ../../prebuilt/third_party/clang/linux-x64/bin/clang++ -MD -MF host_x64-asan-ubsan/obj/src/storage/minfs/libminfs.vnode.cc.o.d -DTOOLCHAIN_VERSION=AD59JKqO1TWgxp7uA0Fq99aIrVCXG2i4HShWi6sFFV8C -DFUCHSIA_API_LEVEL=13 -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES -I../.. -Ihost_x64-asan-ubsan/gen -I../../zircon/system/ulib/zx/include -I../../sdk/lib/fit/include -I../../sdk/lib/stdcompat/include -I../../zircon/system/public -I../../src/zircon/lib/zircon/include -Ifidling/gen/zircon/vdso/zx/zither/legacy_syscall_cdecl -I../../sdk/lib/fit-promise/include -I../../zircon/system/ulib/fbl/include -I../../zircon/system/ulib/storage/buffer/include -Ifidling/gen/sdk/fidl/fuchsia.hardware.block.driver/fuchsia.hardware.block.driver/banjo/cpp -Ibanjoing/gen -Ifidling/gen/sdk/fidl/fuchsia.hardware.block.driver/fuchsia.hardware.block.driver/banjo/c -I../../src/lib/ddk/include -I../../sdk/lib/driver/runtime/include -I../../zircon/system/ulib/async/include -I../../sdk/lib/zbi-format/include -I../../zircon/system/ulib/ddk-platform-defs/include -I../../zircon/system/ulib/syslog/include -Ifidling/gen/sdk/fidl/fuchsia.hardware.block/fuchsia.hardware.block/banjo/c -Ifidling/gen/sdk/fidl/fuchsia.storage.metrics/fuchsia.storage.metrics/banjo/c -Ifidling/gen/sdk/fidl/fuchsia.unknown/fuchsia.unknown/banjo/c -Ifidling/gen/zircon/vdso/zx/zx/banjo/c -I../../src/lib/ddktl/include -I../../sdk/lib/fidl/cpp/wire/include -I../../sdk -Ihost_x64-asan-ubsan/gen/sdk -I../../sdk/lib/fidl_base/include -Ifidling/gen/sdk/fidl/fuchsia.hardware.block/fuchsia.hardware.block/banjo/cpp -Ifidling/gen/sdk/fidl/fuchsia.storage.metrics/fuchsia.storage.metrics/banjo/cpp -Ifidling/gen/sdk/fidl/fuchsia.unknown/fuchsia.unknown/banjo/cpp -Ifidling/gen/zircon/vdso/zx/zx/banjo/cpp -I../../zircon/system/ulib/storage/operation/include -I../../zircon/system/ulib/zircon-internal/include -I../../sdk/lib/fdio/include -I../../src/storage/gpt/include -Ifidling/gen/sdk/fidl/fuchsia.device/fuchsia.device/cpp -Ifidling/gen/sdk/fidl/fuchsia.logger/fuchsia.logger/cpp -Ifidling/gen/sdk/fidl/fuchsia.diagnostics/fuchsia.diagnostics/cpp -Ifidling/gen/sdk/fidl/fuchsia.mem/fuchsia.mem/cpp -Ifidling/gen/sdk/fidl/fuchsia.hardware.block/fuchsia.hardware.block/cpp -Ifidling/gen/sdk/fidl/fuchsia.storage.metrics/fuchsia.storage.metrics/cpp -Ifidling/gen/sdk/fidl/fuchsia.unknown/fuchsia.unknown/cpp -I../../zircon/third_party/ulib/lz4/include -I../../src/storage/lib/disk_inspector/include -I../../zircon/system/ulib/bitmap/include -I../../zircon/system/ulib/range/include -I../../zircon/third_party/ulib/cksum/include -I../../zircon/third_party/ulib/safemath/include -fcolor-diagnostics -fcrash-diagnostics-dir=clang-crashreports -fcrash-diagnostics=all -ffp-contract=off --sysroot=../../prebuilt/third_party/sysroot/linux --target=x86_64-unknown-linux-gnu -ffile-compilation-dir=. -no-canonical-prefixes -fdata-sections -ffunction-sections -O1 -gdwarf-5 -Xclang -debug-info-kind=constructor -g3 -Wall -Wextra -Wconversion -Wextra-semi -Wimplicit-fallthrough -Wnewline-eof -Wstrict-prototypes -Wwrite-strings -Wno-sign-conversion -Wno-unused-parameter -Wnonportable-system-include-path -Wno-type-limits -fvisibility=hidden -Werror -Wno-error=deprecated-declarations -Wa,--fatal-warnings --sysroot=../../prebuilt/third_party/sysroot/linux --target=x86_64-unknown-linux-gnu -fPIE -mllvm -asan-use-private-alias=1 -fno-sanitize-address-use-odr-indicator -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize=vptr -fvisibility-inlines-hidden -stdlib=libc++ -std=c++17 -fno-exceptions -stdlib=libc++ -c ../../src/storage/minfs/vnode.cc -o host_x64-asan-ubsan/obj/src/storage/minfs/libminfs.vnode.cc.o
```
A recent local experiment took about 40 attempts before a difference was observed.

A dwarfdump diff looks like:

```shell
$ diff -u <(../../prebuilt/third_party/clang/linux-x64/bin/llvm-dwarfdump -a host_x64-asan-ubsan/obj/src/storage/minfs/libminfs.vnode.cc.o) <(../../prebuilt/third_party/clang/linux-x64/bin/llvm-dwarfdump -a host_x64-asan-ubsan/obj/src/storage/minfs/tmp-libminfs.vnode.cc.o)
```
```diff
--- /dev/fd/63  2023-07-17 18:55:26.925479892 +0000
+++ /dev/fd/62  2023-07-17 18:55:26.925479892 +0000
@@ -1,4 +1,4 @@
-host_x64-asan-ubsan/obj/src/storage/minfs/libminfs.vnode.cc.o: file format elf64-x86-64
+host_x64-asan-ubsan/obj/src/storage/minfs/tmp-libminfs.vnode.cc.o:     file format elf64-x86-64
 
 .debug_abbrev contents:
 Abbrev table for offset: 0x00000000
@@ -54937,7 +54937,7 @@
 [0x000000000000045f, 0x000000000000047b))
 
 0x0000fd7f: DW_TAG_variable
-                      DW_AT_location   (indexed (0x1c) loclist = 0x00000a67: 
+                      DW_AT_location   (indexed (0x1b) loclist = 0x00000a3d: 
 [0x00000000000002cc, 0x00000000000002d7): DW_OP_breg14 R14+0, DW_OP_convert (0x00000030) "DW_ATE_unsigned_64", DW_OP_convert (0x00000035) "DW_ATE_unsigned_32", DW_OP_stack_value, DW_OP_piece 0x4, DW_OP_breg14 R14+0, DW_OP_constu 0x20, DW_OP_shr, DW_OP_convert (0x00000030) "DW_ATE_unsigned_64", DW_OP_convert (0x00000035) "DW_ATE_unsigned_32", DW_OP_stack_value, DW_OP_piece 0x4
 [0x000000000000046d, 0x000000000000047b): DW_OP_breg14 R14+0, DW_OP_convert (0x00000030) "DW_ATE_unsigned_64", DW_OP_convert (0x00000035) "DW_ATE_unsigned_32", DW_OP_stack_value, DW_OP_piece 0x4, DW_OP_breg14 R14+0, DW_OP_constu 0x20, DW_OP_shr, DW_OP_convert (0x00000030) "DW_ATE_unsigned_64", DW_OP_convert (0x00000035) "DW_ATE_unsigned_32", DW_OP_stack_value, DW_OP_piece 0x4)
 DW_AT_name     ("status")
@@ -55077,7 +55077,7 @@
 DW_AT_high_pc  (0x00000000000004c3)
 
 0x0000fe2a: DW_TAG_variable
-                    DW_AT_location     (indexed (0x1b) loclist = 0x00000a3d: 
+                    DW_AT_location     (indexed (0x1c) loclist = 0x00000a8e: 
                        [0x00000000000004bd, 0x00000000000004c3): DW_OP_breg14 R14+0, DW_OP_convert (0x00000030) "DW_ATE_unsigned_64", DW_OP_convert (0x00000035) "DW_ATE_unsigned_32", DW_OP_stack_value, DW_OP_piece 0x4, DW_OP_breg14 R14+0, DW_OP_constu 0x20, DW_OP_shr, DW_OP_convert (0x00000030) "DW_ATE_unsigned_64", DW_OP_convert (0x00000035) "DW_ATE_unsigned_32", DW_OP_stack_value, DW_OP_piece 0x4)
 DW_AT_name     ("status")
 DW_AT_decl_file        ("./../../src/storage/minfs/vnode.cc")
@@ -73993,7 +73993,7 @@
 0x000009cf
 0x00000a00
 0x00000a31
-0x00000a5b
+0x00000a82
 0x00000aac
 0x00000ad6
 0x00000b00
@@ -74533,13 +74533,13 @@
 
 0x00000a3d: 
 DW_LLE_base_addressx   (0x0000000000000028)
- DW_LLE_offset_pair     (0x00000000000004bd, 0x00000000000004c3): DW_OP_breg14 R14+0, DW_OP_convert 0x30, DW_OP_convert 0x35, DW_OP_stack_value, DW_OP_piece 0x4, DW_OP_breg14 R14+0, DW_OP_constu 0x20, DW_OP_shr, DW_OP_convert 0x30, DW_OP_convert 0x35, DW_OP_stack_value, DW_OP_piece 0x4
-
-0x00000a67: 
-            DW_LLE_base_addressx   (0x0000000000000028)
 DW_LLE_offset_pair     (0x00000000000002cc, 0x00000000000002d7): DW_OP_breg14 R14+0, DW_OP_convert 0x30, DW_OP_convert 0x35, DW_OP_stack_value, DW_OP_piece 0x4, DW_OP_breg14 R14+0, DW_OP_constu 0x20, DW_OP_shr, DW_OP_convert 0x30, DW_OP_convert 0x35, DW_OP_stack_value, DW_OP_piece 0x4
 DW_LLE_offset_pair     (0x000000000000046d, 0x000000000000047b): DW_OP_breg14 R14+0, DW_OP_convert 0x30, DW_OP_convert 0x35, DW_OP_stack_value, DW_OP_piece 0x4, DW_OP_breg14 R14+0, DW_OP_constu 0x20, DW_OP_shr, DW_OP_convert 0x30, DW_OP_convert 0x35, DW_OP_stack_value, DW_OP_piece 0x4
 
+0x00000a8e: 
+            DW_LLE_base_addressx   (0x0000000000000028)
+ DW_LLE_offset_pair     (0x00000000000004bd, 0x00000000000004c3): DW_OP_breg14 R14+0, DW_OP_convert 0x30, DW_OP_convert 0x35, DW_OP_stack_value, DW_OP_piece 0x4, DW_OP_breg14 R14+0, DW_OP_constu 0x20, DW_OP_shr, DW_OP_convert 0x30, DW_OP_convert 0x35, DW_OP_stack_value, DW_OP_piece 0x4
+
 0x00000ab8: 
             DW_LLE_base_addressx   (0x0000000000000028)
 DW_LLE_offset_pair     (0x000000000000042f, 0x000000000000043b): DW_OP_breg14 R14+0, DW_OP_convert 0x30, DW_OP_convert 0x35, DW_OP_stack_value, DW_OP_piece 0x4, DW_OP_breg14 R14+0, DW_OP_constu 0x20, DW_OP_shr, DW_OP_convert 0x30, DW_OP_convert 0x35, DW_OP_stack_value, DW_OP_piece 0x4

```

[llvm-nondet.zip](https://github.com/llvm/llvm-project/files/12072985/llvm-nondet.zip)

Attachment contains:
* vnode.ii (from --save-temps)
* libminfs.vnode.cc.o
* tmp-libminfs.vnode.cc.o (saved copy of the first run)

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWl1z46jS_jXkhsIlI3_pIhdOHO_6fbPJ1CQb77lSIUAyGwRaQI6TX38K5O-xs_ZMZs_U1rimEtN0N0330w30hFgrCsX5Jehege7ogtRups1lTlQhbHmRafZ6OeUA9-cc6sxyM-cMWl1yKDUlEma1kAwqrRh33JRCCVtCoSCVRBVQ166qnW2BaASiYfPzccZhrqXUL0IVkOqyJIrBymhWU24hE3nODVcOtvRKHgI8eBFu1iystEJv3Ggvk5FMSOFeAU52FgG9qPlnZ1zKJQ13YKsF8Dj8qAz3tjuAx24mDEsrYryecbAc4LEUql6gRa8D8DgTajNzBfAVRL-NIPptDGfaunTR6yBiiUJ1Zonn1NmfAI-tof6n04YUHOBxKVRug-YsfG3NlWa8RWlLtxhEo8f7-9vrX4eTu_Tp5vPD5P4OxKPhqJv83___dd9-nBaLql8Po_FfSUIm5un6j1-w6Pz6MJuKnh2PnwbXEI3Gv1__-jAZpsNPk_T25unmFsSjdgzRKL2dXF1_-pSOJg_Dq9ub9GnyMLma3E4e_5MO7-7uH4ePk_u7hy3Gzze_3T_dpI-fh3cPk8fJ0006ubu-_X108wDRZOlGiCaH919wteECePwmDNV-wr5ax0uAx7UUmZ9YADwWisqa8R0Jy54bTwE8zoU7gcs6RnVZkWO8X9pQ1ZkUdFdhCNmadWnkarhRmwsmRYBJwdU2y5xZvdrXm3AzbrwaXhD6mtpXS4mUKWWcyvd2iyqjS2H5yTtZejPP5LkiG3RmtU-8d3fZmOmp_ldNZ1aQ1owY9kIMb2VS0-cWM2Ie1PzdfEbUn95VtKogmoTReq1_bO0DwW_8wsJyf4e5tUJTKyfKswNG7KuiJ6zzlgmUa1OeAe56vQ9USeK8NGI81J_zAPJqpS6-FRbvT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