[clang] [Clang] Fix stack-use-after-return in TryArrayCopy by allocating OpaqueValueExpr on the ASTContext (PR #192080)

via cfe-commits cfe-commits at lists.llvm.org
Sat May 2 22:33:18 PDT 2026


TPPPP72 wrote:

@AaronBallman Test on `sqlite amalgamation 3.53.0`.

```--------------------------------------------------------------------------------
Command:            ./llvm-project/llvm/build/bin/clang-new -c ./sqlite-amalgamation-3530000/sqlite3.c -O2
Massif arguments:   --stacks=yes --depth=20 --massif-out-file=massif.new
ms_print arguments: massif.new
--------------------------------------------------------------------------------


    MB
88.98^                                                                       #
     |                              @                  @                     #
     |                           :  @:::               @             ::::::::#
     |                        ::::::@::                @    :@@::::::: :::: :#
     |                  ::::::: ::: @::              ::@:::::@ ::: : : :::: :#
     |                  :: : :: ::: @:: ::@:::   ::::: @:: ::@ ::: : : :::: :#
     |               ::::: : :: ::: @:: ::@:: :::::: : @:: ::@ ::: : : :::: :#
     |            ::::: :: : :: ::: @:: ::@:: : :::: : @:: ::@ ::: : : :::: :#
     |    ::    :::: :: :: : :: ::: @:: ::@:: : :::: : @:: ::@ ::: : : :::: :#
     |   @: :::::::: :: :: : :: ::: @:: ::@:: : :::: : @:: ::@ ::: : : :::: :#
     |   @: : : :::: :: :: : :: ::: @:: ::@:: : :::: : @:: ::@ ::: : : :::: :#
     |   @: : : :::: :: :: : :: ::: @:: ::@:: : :::: : @:: ::@ ::: : : :::: :#
     |   @: : : :::: :: :: : :: ::: @:: ::@:: : :::: : @:: ::@ ::: : : :::: :#
     |   @: : : :::: :: :: : :: ::: @:: ::@:: : :::: : @:: ::@ ::: : : :::: :#
     |   @: : : :::: :: :: : :: ::: @:: ::@:: : :::: : @:: ::@ ::: : : :::: :#
     |   @: : : :::: :: :: : :: ::: @:: ::@:: : :::: : @:: ::@ ::: : : :::: :#
     | @@@: : : :::: :: :: : :: ::: @:: ::@:: : :::: : @:: ::@ ::: : : :::: :#
     | @ @: : : :::: :: :: : :: ::: @:: ::@:: : :::: : @:: ::@ ::: : : :::: :#
     | @ @: : : :::: :: :: : :: ::: @:: ::@:: : :::: : @:: ::@ ::: : : :::: :#
     | @ @: : : :::: :: :: : :: ::: @:: ::@:: : :::: : @:: ::@ ::: : : :::: :#
   0 +----------------------------------------------------------------------->Gi
     0                                                                   64.65

Number of snapshots: 52
 Detailed snapshots: [1, 2, 20, 25, 34, 39, 51 (peak)]

--------------------------------------------------------------------------------
  n        time(i)         total(B)   useful-heap(B) extra-heap(B)    stacks(B)
--------------------------------------------------------------------------------
  0              0                0                0             0            0
  1  1,121,270,048       21,627,304       21,357,909       194,723       74,672
```

```--------------------------------------------------------------------------------
Command:            ./llvm-project/llvm/build/bin/clang-old -c ./sqlite-amalgamation-3530000/sqlite3.c -O2
Massif arguments:   --stacks=yes --depth=20 --massif-out-file=massif.old
ms_print arguments: massif.old
--------------------------------------------------------------------------------


    MB
88.98^                                                                       #
     |   @@                         @                  @                     #
     |   @                     ::  :@:::               @       :   :::::::@::#
     |   @                    ::::::@:::              :@     :::@::::@::::@::#
     |   @               ::::::::: :@:::     :       ::@:::@::::@::::@::::@::#
     |   @             ::::: ::::: :@:::::::::    :::::@:: @::::@::::@::::@::#
     |   @          :::::::: ::::: :@::::::: ::::::::::@:: @::::@::::@::::@::#
     |   @        ::: :::::: ::::: :@::::::: :::: :::::@:: @::::@::::@::::@::#
     |   @  :  :::::: :::::: ::::: :@::::::: :::: :::::@:: @::::@::::@::::@::#
     |   @ ::::: :::: :::::: ::::: :@::::::: :::: :::::@:: @::::@::::@::::@::#
     |   @ ::::: :::: :::::: ::::: :@::::::: :::: :::::@:: @::::@::::@::::@::#
     |   @ ::::: :::: :::::: ::::: :@::::::: :::: :::::@:: @::::@::::@::::@::#
     |   @ ::::: :::: :::::: ::::: :@::::::: :::: :::::@:: @::::@::::@::::@::#
     |  :@ ::::: :::: :::::: ::::: :@::::::: :::: :::::@:: @::::@::::@::::@::#
     |  :@ ::::: :::: :::::: ::::: :@::::::: :::: :::::@:: @::::@::::@::::@::#
     | ::@ ::::: :::: :::::: ::::: :@::::::: :::: :::::@:: @::::@::::@::::@::#
     | ::@ ::::: :::: :::::: ::::: :@::::::: :::: :::::@:: @::::@::::@::::@::#
     | ::@ ::::: :::: :::::: ::::: :@::::::: :::: :::::@:: @::::@::::@::::@::#
     |:::@ ::::: :::: :::::: ::::: :@::::::: :::: :::::@:: @::::@::::@::::@::#
     |:::@ ::::: :::: :::::: ::::: :@::::::: :::: :::::@:: @::::@::::@::::@::#
   0 +----------------------------------------------------------------------->Gi
     0                                                                   64.65

Number of snapshots: 86
 Detailed snapshots: [4, 27, 45, 48, 57, 67, 77, 85 (peak)]

--------------------------------------------------------------------------------
  n        time(i)         total(B)   useful-heap(B) extra-heap(B)    stacks(B)
--------------------------------------------------------------------------------
  0              0                0                0             0            0
  1    483,688,611       12,306,592       12,140,857       119,703       46,032
  2  1,675,050,673       27,378,544       27,106,608       213,032       58,904
  3  2,560,865,797       37,286,904       36,896,503       332,529       57,872
  4  3,821,091,044       89,361,560       84,881,983     4,405,865       73,712
```

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


More information about the cfe-commits mailing list