Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

The problem with -fpermissive #11402

Closed
Closed
Labels
Component: CompilationRelated to compilation of Arduino sketches Type: Bug Type: DuplicateAnother item already exists for this topic
@LostInCompilation

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

No one assigned

    Labels

    Component: CompilationRelated to compilation of Arduino sketches Type: Bug Type: DuplicateAnother item already exists for this topic

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /