AprilRobotics / apriltag

AprilTag is a visual fiducial system popular for robotics research.
https://april.eecs.umich.edu/software/apriltag
Other
1.47k stars 522 forks source link

Build fail on Ubuntu Noble in g2d.c: `last_quadrant` is used unitialized; treat-all-warnings-as-errors #326

Closed ojura closed 1 month ago

ojura commented 1 month ago

Build fails because of unitialized variable use:

  /<<BUILDDIR>>package/common/g2d.c: In function ‘g2d_polygon_contains_point’:
  /<<BUILDDIR>>package/common/g2d.c:351:17: error: ‘last_quadrant’ may be used uninitialized [-Werror=maybe-uninitialized]
    351 |             int dquadrant = quadrant - last_quadrant;
        |                 ^~~~~~~~~
  /<<BUILDDIR>>package/common/g2d.c:324:9: note: ‘last_quadrant’ was declared here
    324 |     int last_quadrant;
        |         ^~~~~~~~~~~~~
christian-rauch commented 1 month ago

This should be fixed by https://github.com/AprilRobotics/apriltag/pull/324. I could not reproduce the issue with the 24.04 Docker image. Can you check if the PR solves your issue?

christian-rauch commented 1 month ago

Can you provide instructions on how to reproduce this? Which CMake generator and compiler are you using? Is this in a Docker container or a "bare metal" installation?

ojura commented 1 month ago

Hi @christian-rauch, sorry for missing your response. I am glad that you figured it out and thanks for the fix. For me, it was clear from the source code that the last_quadrant variable was uninitialized, and I didn't consider it necessary to include more detailed reproduction info.

christian-rauch commented 1 month ago

I could see that it was not initialised too. But I was still curious how to reproduce the error locally as I have seen this issue on other CI pipelines too but I could reproduce this in a Docker container. Anyway, this should now be fixed.