Skip to content

Fix undefined behavior on noneed#3001

Open
wsmoses wants to merge 2 commits intomainfrom
undefv
Open

Fix undefined behavior on noneed#3001
wsmoses wants to merge 2 commits intomainfrom
undefv

Conversation

@wsmoses
Copy link
Copy Markdown
Member

@wsmoses wsmoses commented Mar 17, 2026

Fixes #2987

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 17, 2026

Your PR requires formatting changes to meet the project's style guidelines.
Please consider running Runic (git runic main) to apply these changes.

Click here to view the suggested changes.
diff --git a/test/basic.jl b/test/basic.jl
index c667a73d..c37ebfac 100644
--- a/test/basic.jl
+++ b/test/basic.jl
@@ -708,7 +708,7 @@ import Enzyme
 function wlj(x::Real, lower::Bool, upper::Real)
     lbounded, ubounded = lower, isfinite(upper)
     return if lbounded && ubounded
-        (log(x/upper) / one(x)), 0.0
+        (log(x / upper) / one(x)), 0.0
     elseif lbounded
         log(x), 0.0
     elseif ubounded
@@ -726,7 +726,7 @@ function (f::Foo)(rx::AbstractArray)
 end
 
 @testset "NoNeed result" begin
-   x = [0.5]
-   f = Foo(1.0)
-   @test Enzyme.jacobian(Enzyme.Reverse, f, x)[1][1] ≈ 2.0
+    x = [0.5]
+    f = Foo(1.0)
+    @test Enzyme.jacobian(Enzyme.Reverse, f, x)[1][1] ≈ 2.0
 end

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 17, 2026

Benchmark Results

main cadec1a... main / cadec1a...
basics/make_zero/namedtuple 0.0546 ± 0.0028 μs 0.0526 ± 0.0025 μs 1.04 ± 0.072
basics/make_zero/struct 0.27 ± 0.0058 μs 0.265 ± 0.0054 μs 1.02 ± 0.03
basics/overhead 4.03 ± 0.001 ns 4.64 ± 0.01 ns 0.868 ± 0.0019
basics/remake_zero!/namedtuple 0.225 ± 0.01 μs 0.225 ± 0.008 μs 0.997 ± 0.057
basics/remake_zero!/struct 0.228 ± 0.01 μs 0.229 ± 0.011 μs 0.992 ± 0.063
fold_broadcast/multidim_sum_bcast/1D 10.3 ± 0.27 μs 10.2 ± 0.21 μs 1 ± 0.033
fold_broadcast/multidim_sum_bcast/2D 12.4 ± 0.24 μs 12.4 ± 0.27 μs 0.998 ± 0.029
time_to_load 1.06 ± 0.0033 s 1.08 ± 0.0033 s 0.981 ± 0.0043

Benchmark Plots

A plot of the benchmark results has been uploaded as an artifact at https://github.com/EnzymeAD/Enzyme.jl/actions/runs/23198081816/artifacts/5966036675.

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.

1.10 reverse-mode correctness error

1 participant