Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrectly inlines non-final variable #27

Closed
julianhyde opened this issue May 28, 2014 · 0 comments
Closed

Incorrectly inlines non-final variable #27

julianhyde opened this issue May 28, 2014 · 0 comments

Comments

@julianhyde
Copy link
Owner

Linq4j BlockBuilder incorrectly inlines a variable that might be assigned more than once along a code path. For example, in

long x = 0;
final long y = System.currentTimeMillis();
if (System.nanoTime() > 0L) {
  x = y;
}

it incorrectly inlines x, to yield

if (System.nanoTime() > 0L) {
  System.currentTimeMillis();
}

The fix is to only inline variables that are marked 'final'. The java compiler will ensure that they cannot be assigned more than once (by any code path) and cannot be read before they have been initialized.

This change may break code that relies on Linq4j inlining effectively final (but not explicitly final) variables.

@julianhyde julianhyde changed the title Variable assigned in 'if' or 'for' incorrectly inlined Incorrectly inlines non-final variable May 28, 2014
julianhyde added a commit to julianhyde/optiq that referenced this issue May 28, 2014
…RANK windowed aggregate function".

Changes to the `AggImplementor` and `WinAggImplementor` interfaces to provide richer context to user code implementing a (windowed) aggregate function.

RelDataType instances created via built-in type strategies are now NOW NULL. Add 'boolean nullable' parameter to RelDataTypeImpl.proto methods.

Upgrade to linq4j-0.4, and add 'final' to code-generator variables, per julianhyde/linq4j#27.
ldming pushed a commit to ldming/mycalcite that referenced this issue Sep 13, 2018
…RANK windowed aggregate function".

Changes to the `AggImplementor` and `WinAggImplementor` interfaces to provide richer context to user code implementing a (windowed) aggregate function.

RelDataType instances created via built-in type strategies are now NOW NULL. Add 'boolean nullable' parameter to RelDataTypeImpl.proto methods.

Upgrade to linq4j-0.4, and add 'final' to code-generator variables, per julianhyde/linq4j#27.
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

No branches or pull requests

1 participant