Skip to content

Conversation

ringabout
Copy link
Member

@ringabout ringabout commented Oct 7, 2025

fixes #25204

  of mUnaryMinusI..mAbsI: unaryArithOverflow(p, e, d, op)
  of mAddI..mPred: binaryArithOverflow(p, e, d, op)

Arithmetic operations may raise exceptions. So we cannot entrust the optimizer to skip result initialization in this situation, as complained righteously by gcc and clang: warning: ‘result’ may be used uninitialized [-Wmaybe-uninitialize].

With this PR, clang -c -Wuninitialized -O1 @psystem.nim.c no longer gives warnings

@Araq Araq merged commit 7c65d9e into devel Oct 8, 2025
21 checks passed
@Araq Araq deleted the pr_Salbe branch October 8, 2025 17:10
Copy link
Contributor

github-actions bot commented Oct 8, 2025

Thanks for your hard work on this PR!
The lines below are statistics of the Nim compiler built from 7c65d9e

Hint: mm: orc; opt: speed; options: -d:release
183144 lines; 8.127s; 661.699MiB peakmem

narimiran pushed a commit that referenced this pull request Oct 13, 2025
…@psystem.nim.c in ORC (#25209)

fixes #25204

```nim
  of mUnaryMinusI..mAbsI: unaryArithOverflow(p, e, d, op)
  of mAddI..mPred: binaryArithOverflow(p, e, d, op)
```
Arithmetic operations may raise exceptions. So we cannot entrust the
optimizer to skip `result` initialization in this situation, as
complained righteously by `gcc` and `clang`: `warning: ‘result’ may be
used uninitialized [-Wmaybe-uninitialize]`.

With this PR, `clang -c -Wuninitialized -O1 @psystem.nim.c` no longer
gives warnings

(cherry picked from commit 7c65d9e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Uninitialized variable usage in resize__system_u... in @psystem.nim.c in ORC

2 participants