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

[FIX] Building with strict aliasing #289

Merged
merged 1 commit into from
Jun 3, 2024
Merged

Conversation

Nimuedaertya
Copy link
Contributor

Contribution description

Motivation

  • building with strict aliasing flags failed
  • used additional flags shown below
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_FORTIFY_SOURCE=3 -fdiagnostics-color=always -frecord-gcc-switches")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-clash-protection -march=native -O2 -pipe -U_FORTIFY_SOURCE")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=format-security -Werror=implicit-int -Werror=int-conversion -Wformat")

How:

  • modify casted variable type in test case to initialized type

Issues/PRs references

Motivation
  - building with strict aliasing flags fails
  - used flags shown below

```
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_FORTIFY_SOURCE=3 -fdiagnostics-color=always -frecord-gcc-switches")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-clash-protection -march=native -O2 -pipe -U_FORTIFY_SOURCE")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=format-security -Werror=implicit-int -Werror=int-conversion -Wformat")
```

How:
  - modify casted variable type in test case to initialized type

Related:
  - fixes rtrlib#287
@Nimuedaertya Nimuedaertya self-assigned this May 10, 2024
Copy link
Member

@tanneberger tanneberger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just for my understanding the ipv6 address is encoded as an array of 4xuint32_t, why do we only write the first two values instead of all 4.

And please be aware of the implicit conversion (expansion) of uint32_t* to uint64_t*.

@waehlisch waehlisch merged commit e5aaf07 into rtrlib:master Jun 3, 2024
1 check was pending
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build fails with strict-aliasing violations
4 participants