-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Confusion caused by use of -fpermissive in AVR and megaAVR compilation recipes #10154
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
Comments
Related: arduino/ArduinoCore-avr#268 |
This is not valid C++ code, and should result in a compiler error. The standard says this program is ill-formed, not just undefined behaviour. This exact scenario is called out the in the language standard: |
The reason it compiles is due to the use of the I suppose we could close this as covered by arduino/ArduinoCore-avr#268. That is somewhat specific to the AVR platform, due to being in its repository, but I added a comment there noting that the same applies to the Arduino megaAVR Boards platform. |
Is it possible to selectively re-enable errors that -fpermissive is hiding? Since it's producing results that are not helpful, allowing projects with this defect to compile is counter-productive - silently broken is much worse than in-your-face broken. |
I agree.
But in the previous example, there is no compilation error, there is an incorrectly assembled final code. |
Hi.
There is the problem.
=============================================================
Sketch uses 1668 bytes (5%) of program storage space…
Global variables use 294 bytes (14%) of dynamic memory…
=============================================================
Sketch uses 1596 bytes (4%) of program storage space…
Global variables use 244 bytes (11%) of dynamic memory…
=============================================================
Note the noticeably smaller code size in the second case.
Moreover, this does not depend on the number of blocks below the second one!
It looks like the linker just doesn't include them in the final code!
Bye.
The text was updated successfully, but these errors were encountered: