-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Closed
Labels
Component: CompilationRelated to compilation of Arduino sketchesRelated to compilation of Arduino sketchesType: BugType: DuplicateAnother item already exists for this topicAnother item already exists for this topic
Description
Today a user from the German Arduino Facebook Group ran into a problem with switch/case producing invalid code. After some hours of searching, it turns out the culprit is the -fpermissive flag in Arduino.
This code should never ever compile, but it does thanks to the flag:
switch(...)
{
case 0:
int val = 42; // This should throw an error. You're not allowed to declare variables in a case label without using additional brackets! Results in crashing assembly
// ...
break;
// ...
}
This is serious business, because the compiler produces an invalid assembly that skips instructions randomly, and the compiler doesn't even give an error.
I know why -fpermissive was introduced and also read the discussion here: #5021 (comment)
and here: arduino/ArduinoCore-avr#268
But accepting invalid and crashing code just because Arduino wants to support bad written libs and likes to suppress all warning is just non sense.
What are the plans for the flag?
Metadata
Metadata
Assignees
Labels
Component: CompilationRelated to compilation of Arduino sketchesRelated to compilation of Arduino sketchesType: BugType: DuplicateAnother item already exists for this topicAnother item already exists for this topic