Fraunhofer-AISEC / cpg

A library to extract Code Property Graphs from C/C++, Java, Go, Python, Ruby and every other language through LLVM-IR.
https://fraunhofer-aisec.github.io/cpg/
Apache License 2.0
282 stars 62 forks source link

Constant propagation does not work with short hand assignment in Go #1462

Closed oxisto closed 8 months ago

oxisto commented 8 months ago

If we use x := "a" instead of a regular declaration + assignment, the value evaluator does not correctly propagate the constant, since it only uses the initialiser field, which is empty. In this case, the firstAssignment property (or a DFG edge?) should be used instead.

oxisto commented 8 months ago

Actually we should use the DFG instead, but this is bugged because of #1463