Incorrect handling of left shift overflow on non-x86_64 (returns value instead of runtime error)

Open
#1,315 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Domain
tooling

Research direction

Start with the error.integer_left_shift_runtime.jsonnet reproduction and run the provided jsonnet command on a non-x86_64 architecture, comparing it with x86_64 behavior. Trace the integer left-shift runtime handling and its regression test; done means (1 << 63) raises a runtime error and the test no longer reports a successful exit with a wrapped value.

Written by the indexing model from the issue text.

Description

Summary

On non-x86_64 architectures, Jsonnet does not raise a runtime error for integer left shift overflow. Instead, it returns a wrapped negative value and exits successfully (code 0). This contradicts expected behavior and causes regression test failure.

Affected Version:

Reproduction:

jsonnet --ext-str var1=test --ext-code var2='{x:1,y:2}' error.integer_left_shift_runtime.jsonnet

Test case (error.integer_left_shift_runtime.jsonnet):

(1 << 63)

Built at:
https://koji.fedoraproject.org/koji/taskinfo?taskID=143856013
https://koji.fedoraproject.org/koji/taskinfo?taskID=143856014
https://koji.fedoraproject.org/koji/taskinfo?taskID=143856015

Which contains both a root.log showing installed packages and a build.log showing the output from the compile/test

Dominant language
Jsonnet
Stars
7.6k
Forks
475
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from google/jsonnet

All issues in google/jsonnet

Similar issues

More DevTools issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.