Skip to content

Commit

Permalink
Add minimal example to reproduce memory leak in pushforward
Browse files Browse the repository at this point in the history
  • Loading branch information
vaithak committed Feb 5, 2024
1 parent d50a33f commit 18da60f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/FirstDerivative/FunctionCallsWithResults.C
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// RUN: %cladclang %s -I%S/../../include -oFunctionCallsWithResults.out 2>&1 | FileCheck %s
// RUN: ./FunctionCallsWithResults.out | FileCheck -check-prefix=CHECK-EXEC %s
//CHECK-NOT: {{.*error|warning|note:.*}}

#include "clad/Differentiator/Differentiator.h"

Expand Down Expand Up @@ -89,6 +90,7 @@ double sum_of_squares(double u, double v) {
// CHECK-NEXT: }

double fn1(double i, double j) {
const int __k = 5; // random constant declaration for testing
double res = sum_of_squares(i, j);
res += sum_of_squares(j, i);
return res;
Expand All @@ -97,6 +99,8 @@ double fn1(double i, double j) {
// CHECK: double fn1_darg0(double i, double j) {
// CHECK-NEXT: double _d_i = 1;
// CHECK-NEXT: double _d_j = 0;
// CHECK-NEXT: const int _d_k = 0;
// CHECK-NEXT: const int __k0 = 5;
// CHECK-NEXT: clad::ValueAndPushforward<double, double> _t0 = sum_of_squares_pushforward(i, j, _d_i, _d_j);
// CHECK-NEXT: double _d_res = _t0.pushforward;
// CHECK-NEXT: double res = _t0.value;
Expand Down

0 comments on commit 18da60f

Please sign in to comment.