abseil / abseil/abseil-cpp

[Bug]: `FixedArray` triggers `-Wfree-nonheap-object` warnings in LTO builds

Đang mở
#1,843 3 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
C++
Star
18.1k
Fork
3.2k
Merge trung bình
20 giờ 36 phút
Pull request đã merge (30 ngày)
1

Mô tả

### Describe the issue

Using GCC 14.2.1 we see the following warnings:

```console
/usr/include/eigen3/Eigen/src/Core/ProductEvaluators.h:29: note: a type with different bases is defined in another translation unit
29 | struct evaluator >
[788/969] Linking CXX executable bin/numeric_diff_cost_function_test
In member function ‘deallocate’,
inlined from ‘deallocate’ at /usr/include/c++/14.2.1/bits/alloc_traits.h:513:23,
inlined from ‘__dt_base ’ at /home/sergiu/Projects/ceres-solver/third_party/abseil-cpp/absl/container/fixed_array.h:481:36,
inlined from ‘__dt_base ’ at /home/sergiu/Projects/ceres-solver/third_party/abseil-cpp/absl/container/fixed_array.h:174:3,
inlined from ‘EvaluateJacobianForParameterBlock’ at /home/sergiu/Projects/ceres-solver/include/ceres/internal/numeric_diff.h:170:3,
inlined from ‘Apply’ at /home/sergiu/Projects/ceres-solver/include/ceres/internal/numeric_diff.h:462:52,
inlined from ‘Evaluate’ at /home/sergiu/Projects/ceres-solver/include/ceres/numeric_diff_cost_function.h:262:47:
/usr/include/c++/14.2.1/bits/new_allocator.h:172:33: warning: ‘operator delete’ called on unallocated object ‘residual_array’ [-Wfree-nonheap-object]
172 | _GLIBCXX_OPERATOR_DELETE(_GLIBCXX_SIZED_DEALLOC(__p, __n));
| ^
/home/sergiu/Projects/ceres-solver/include/ceres/internal/numeric_diff.h: In member function ‘Evaluate’:
/home/sergiu/Projects/ceres-solver/include/ceres/internal/numeric_diff.h:129:30: note: declared here
129 | absl::FixedArray residual_array(num_residuals_internal);
| ^
In member function ‘deallocate’,
inlined from ‘deallocate’ at /usr/include/c++/14.2.1/bits/alloc_traits.h:513:23,
inlined from ‘__dt_base ’ at /home/sergiu/Projects/ceres-solver/third_party/abseil-cpp/absl/container/fixed_array.h:481:36,
inlined from ‘__dt_base ’ at /home/sergiu/Projects/ceres-solver/third_party/abseil-cpp/absl/container/fixed_array.h:174:3,
inlined from ‘EvaluateJacobianForParameterBlock’ at /home/sergiu/Projects/ceres-solver/include/ceres/internal/numeric_diff.h:170:3,
inlined from ‘Apply’ at /home/sergiu/Projects/ceres-solver/include/ceres/internal/numeric_diff.h:462:52,
inlined from ‘Evaluate’ at /home/sergiu/Projects/ceres-solver/include/ceres/numeric_diff_cost_function.h:262:47:
/usr/include/c++/14.2.1/bits/new_allocator.h:172:33: warning: ‘operator delete’ called on unallocated object ‘residual_array’ [-Wfree-nonheap-object]
172 | _GLIBCXX_OPERATOR_DELETE(_GLIBCXX_SIZED_DEALLOC(__p, __n));
| ^
/home/sergiu/Projects/ceres-solver/include/ceres/internal/numeric_diff.h: In member function ‘Evaluate’:
/home/sergiu/Projects/ceres-solver/include/ceres/internal/numeric_diff.h:129:30: note: declared here
129 | absl::FixedArray residual_array(num_residuals_internal);
|
```

### Steps to reproduce the problem

1. Construct `absl::FixedArray a(n)`.
2. Compile using `-flto=auto`.

### What version of Abseil are you using?

The `lts_2024_01_16` branch.

### What operating system and version are you using?

ArchLinux

### What compiler and version are you using?

GCC 14.2.1

### What build system are you using?

cmake version 3.31.5

### Additional context

_No response_

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.