Skip to content

Commit 677e259

Browse files
mlxdchaeyeunpark
andauthored
Fix for maybe uninitiailized warning/error with GCC11 (#310)
* Fix maybe uninit for GCC11 * Auto update version * Trigger CI Co-authored-by: Dev version update bot <[email protected]>
1 parent fc2f3e4 commit 677e259

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

pennylane_lightning/_version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
Version number (major.minor.patch[-label])
1717
"""
1818

19-
__version__ = "0.25.0-dev0"
19+
__version__ = "0.25.0-dev1"

pennylane_lightning/src/bindings/Bindings.hpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,13 @@ auto alignedNumpyArray(CPUMemoryModel memory_model, size_t size)
141141
auto capsule = pybind11::capsule(ptr, &Util::alignedFree);
142142
return pybind11::array{
143143
pybind11::dtype::of<T>(), {size}, {sizeof(T)}, ptr, capsule};
144-
} // else
145-
void *ptr = malloc(sizeof(T) * size);
146-
auto capsule = pybind11::capsule(ptr, free);
144+
}
145+
void *ptr = static_cast<void *>(new T[size]);
146+
auto capsule =
147+
pybind11::capsule(ptr, [](void *p) { delete static_cast<T *>(p); });
147148
return pybind11::array{
148149
pybind11::dtype::of<T>(), {size}, {sizeof(T)}, ptr, capsule};
149150
}
150-
151151
/**
152152
* @brief Create a numpy array whose underlying data is allocated by
153153
* lightning.

0 commit comments

Comments
 (0)