From 6e3ee1a9856e09c3593e93b578d5eee5620822fb Mon Sep 17 00:00:00 2001 From: Vaibhav Thakkar Date: Thu, 1 Feb 2024 13:24:43 +0100 Subject: [PATCH] Add minimal example to reproduce memory leak in pushforward --- test/FirstDerivative/FunctionCallsWithResults.C | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/FirstDerivative/FunctionCallsWithResults.C b/test/FirstDerivative/FunctionCallsWithResults.C index aa99017fc..65da54a0c 100644 --- a/test/FirstDerivative/FunctionCallsWithResults.C +++ b/test/FirstDerivative/FunctionCallsWithResults.C @@ -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" @@ -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; @@ -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 _t0 = sum_of_squares_pushforward(i, j, _d_i, _d_j); // CHECK-NEXT: double _d_res = _t0.pushforward; // CHECK-NEXT: double res = _t0.value;