Skip to content

Change return type of merge#48

Open
cnettel wants to merge 1 commit intoodelaneau:masterfrom
cnettel:master
Open

Change return type of merge#48
cnettel wants to merge 1 commit intoodelaneau:masterfrom
cnettel:master

Conversation

@cnettel
Copy link

@cnettel cnettel commented Feb 15, 2021

Avoid spurious warnings and more importantly, aggressive compiler optimizations leading to crashes. gcc 9.3 and 10.2 both crashed at odd locations when high optimization levels were enabled and the return type was bool with no return statement. In general, compiler optimizatons are allowed to assume that "undefined behavior" does not occur, but I could not swear on a simple return statement missing going into that category.

Avoid spurious warnings and more importantly, aggressive compiler optimizations leading to crashes. gcc 9.3 and 10.2 both crashed at odd locations when high optimization levels were enabled and the return type was bool with no return statement. In general, compiler optimizatons are allowed to assume that "undefined behavior" does not occur, but I could not swear on a simple return statement missing going into that category.
@cnettel
Copy link
Author

cnettel commented Feb 15, 2021

This supposedly fixes issue #45.

@leecbaker
Copy link

Adding a warning like -Wreturn-type or perhaps even an error with -Werror=return-type to the build scripts would prevent this type of programming error from happening again in the future.

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.

2 participants