Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random fixes for GCC 13 #21738

Merged
merged 2 commits into from Jul 6, 2023
Merged

Random fixes for GCC 13 #21738

merged 2 commits into from Jul 6, 2023

Conversation

patrickelectric
Copy link
Contributor

Solved SITL compilation problem with GCC 13

px4:

/home/patrick/git/blue/PX4-Autopilot/platforms/posix/src/px4/common/px4_daemon/pxh.cpp: In member function ‘void px4_daemon::Pxh::run_remote_pxh(int, int)’:                                                                   
/home/patrick/git/blue/PX4-Autopilot/platforms/posix/src/px4/common/px4_daemon/pxh.cpp:208:25: error: ‘uint8_t’ was not declared in this scope                                                                                 
  208 |                         uint8_t buffer[512];    

SquareMatrix:

In file included from /home/patrick/git/blue/PX4-Autopilot/src/lib/matrix/matrix/math.hpp:8,                                                                                                                                   
                 from /home/patrick/git/blue/PX4-Autopilot/src/lib/mathlib/math/Functions.hpp:45,                                                                                                                              
                 from /home/patrick/git/blue/PX4-Autopilot/src/lib/mathlib/math/filter/LowPassFilter2p.hpp:41,                                                                                                                 
                 from /home/patrick/git/blue/PX4-Autopilot/src/lib/controllib/BlockDelay.hpp:48,                                                                                                                               
                 from /home/patrick/git/blue/PX4-Autopilot/src/lib/controllib/blocks.hpp:42,                                                                                                                                   
                 from /home/patrick/git/blue/PX4-Autopilot/src/modules/local_position_estimator/sensors/../BlockLocalPositionEstimator.hpp:7,                                                                                  
                 from /home/patrick/git/blue/PX4-Autopilot/src/modules/local_position_estimator/sensors/lidar.cpp:1:                                                                                                           
In member function ‘Type& matrix::Matrix<Type, M, N>::operator()(size_t, size_t) [with Type = float; long unsigned int M = 1; long unsigned int N = 1]’,                                                                       
    inlined from ‘bool matrix::inv(const SquareMatrix<Type, M>&, SquareMatrix<Type, M>&, size_t) [with Type = float; long unsigned int M = 1]’ at /home/patrick/git/blue/PX4-Autopilot/src/lib/matrix/matrix/SquareMatrix.hpp:3
49:20:                                                                                                                                                                                                                         
/home/patrick/git/blue/PX4-Autopilot/src/lib/matrix/matrix/Matrix.hpp:96:29: error: array subscript 1 is above array bounds of ‘float [1][1]’ [-Werror=array-bounds=]                                                          
   96 |                 return _data[i][j];                                                                                                                                                                                    
      |           

Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
@dagar
Copy link
Member

dagar commented Jun 19, 2023

Where are we actually hitting this single element SquareMatrix and how did it slip through before?

Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
@patrickelectric
Copy link
Contributor Author

patrickelectric commented Jun 20, 2023

changed to fix the code style.

Where are we actually hitting this single element SquareMatrix and how did it slip through before?

PX4-Autopilot/blob/fixes/src/modules/local_position_estimator/sensors/sonar.cpp#L105

It appears that SquareMatrix<float, n_y_sonar> trigger the issue, where n_y_sonar is defined as 1.

PX4-Autopilot/blob/fixes/src/modules/local_position_estimator/BlockLocalPositionEstimator.hpp#L136

enum {Y_sonar_z = 0, n_y_sonar};

The problem was not raised before on CI because it runs on debian focal px4-dev-simulation-focal, where gcc version is 9. I'm currently using 13.1.1 20230429

@junwoo091400 junwoo091400 added the Build System 🏗️ Build systems like CMakelist, Makefile, Arm compiler, etc label Jun 26, 2023
@bkueng bkueng merged commit 39e04d9 into PX4:main Jul 6, 2023
76 of 84 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build System 🏗️ Build systems like CMakelist, Makefile, Arm compiler, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants