Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Fix comparison and narrowing errors reported by GCC #22821

Merged
merged 7 commits into from
Mar 1, 2019
Merged

Fix comparison and narrowing errors reported by GCC #22821

merged 7 commits into from
Mar 1, 2019

Conversation

am11
Copy link
Member

@am11 am11 commented Feb 24, 2019

Contributes to: #22684

Copy link

@franksinankaya franksinankaya left a comment

Choose a reason for hiding this comment

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

I removed unused function warnings

@am11
Copy link
Member Author

am11 commented Feb 24, 2019

I removed unused function warnings

Is it in a separate branch?

I have made these changes on top of your gcc_compile branch (which has been slightly diverged from dotnet's master), built on GCC. The overall progress is around 12%. Next batch of errors come from gc.cpp

After that I cherry-picked my commits on top of dotnet/master, compiled with clang and pushed.

@franksinankaya
Copy link

I will rebase that branch

@am11
Copy link
Member Author

am11 commented Feb 24, 2019

OK, do you suggest that we leave out changes made in src/inc/internalunknownimpl.h in this PR?

@franksinankaya
Copy link

Here is the new branch: https://github.com/franksinankaya/coreclr/pull/new/gcc_compile_rebase

am11 and others added 2 commits February 24, 2019 15:53
#endif

MCC_API VType1 sum(float first, ...) {
MCC_API VType1 sum(double first, ...) {
Copy link
Member

Choose a reason for hiding this comment

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

This is not the same test anymore. Was the previous test not valid or unnecessary?

Copy link
Member Author

@am11 am11 Feb 25, 2019

Choose a reason for hiding this comment

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

Three compilers have different issues with the implementation.

For Clang & GCC, see: https://stackoverflow.com/a/24967341

clang had no issues with va_args, but warned on va_start: warning: passing an object that undergoes default argument promotion to 'va_start' has undefined behavior

gcc had no issue with va_start, but warned about promotion in va_args (implied that va_args's second argument should explicitly be double).

MSVC required more casts: float x = (float)doubleValue (note original version already has few of them).

This is not the same test anymore.

If according to C99 and C11 standards (which C++ include by reference), these promotions may take place under the wraps, then this change only makes the compilers' implicit behavior explicit, no?

Copy link
Member

Choose a reason for hiding this comment

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

Was the previous test not valid or unnecessary?

Seems that the previous test wasn't really valid as written. I didn't know the promotion rules regarding varargs - thanks. This change makes sense then as I agree making the argument type explicit is a laudable goal. Someone from @dotnet/jit-contrib should review this test change as well.

@franksinankaya
Copy link

franksinankaya commented Feb 25, 2019 via email

@am11
Copy link
Member Author

am11 commented Feb 25, 2019

For the record, I am now pressing Ready for review button. 😸

image

@am11 am11 marked this pull request as ready for review February 25, 2019 12:47
@am11
Copy link
Member Author

am11 commented Feb 25, 2019

Thanks for all your reviews, tips, tricks and traps! (looking for more)

@am11
Copy link
Member Author

am11 commented Feb 27, 2019

test Ubuntu x64 Checked CoreFX Tests
test OSX10.12 x64 Checked Innerloop Build and Test

@franksinankaya
Copy link

This looks good to me. Any other comments?

Copy link
Member

@janvorli janvorli left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@janvorli janvorli merged commit fd448f7 into dotnet:master Mar 1, 2019
@am11 am11 deleted the fix/signed-compare-and-narrowing branch March 1, 2019 18:00
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
…and-narrowing

Fix comparison and narrowing errors reported by GCC

Commit migrated from dotnet/coreclr@fd448f7
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants