Skip to content

fix up __float128 and _Float128 support #4629

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

Merged
merged 2 commits into from
May 15, 2019
Merged

fix up __float128 and _Float128 support #4629

merged 2 commits into from
May 15, 2019

Conversation

kroening
Copy link
Member

@kroening kroening commented May 8, 2019

_Float128 is a keyword, defined in ISO/IEC TS 18661-3:2015, and exists since
gcc 7.0. clang does not offer it.

__float128 is a typedef in gcc since 4.3/4.5, depending on architecture.

__float128 is a keyword in clang.

This PR attempts to clean this up.

  • Each commit message has a non-empty body, explaining why the change was made.
  • n/a Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • n/a The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • n/a My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • n/a White-space or formatting changes outside the feature-related changed lines are in commits of their own.

@tautschnig
Copy link
Collaborator

I thought we were explicitly testing different Clang and GCC versions in some build configurations. Did I get this wrong?

@kroening
Copy link
Member Author

kroening commented May 8, 2019

@tautschnig This fix here is independent of that, meaning we did the wrong thing in response to a particular version.

Independently, the current behavior is that goto-cc does check the gcc version, whereas cbmc does not. CBMC uses a default, which works for gcc >=4.3 and <7.0, i.e., this will fail with gcc >= 7. We could/should consider checking in cbmc as well.

Copy link
Collaborator

@tautschnig tautschnig left a comment

Choose a reason for hiding this comment

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

I'm assuming that our tests now actually test something.

@tautschnig
Copy link
Collaborator

@kroening This is failing CI on CodeBuild (Linux).

@tautschnig tautschnig assigned kroening and unassigned smowton and tautschnig May 8, 2019
@kroening
Copy link
Member Author

kroening commented May 9, 2019

@tautschnig Yes, this is to be expected. I am investigating whether enabling _Float128 by default will break users who have gcc <7.0.

@kroening
Copy link
Member Author

kroening commented May 9, 2019

@tautschnig Unfortunately, math.h in gcc-6 does the following:
typedef __float128 _Float128;
So we can either
a) special-case that typedef; or
b) check the gcc version in CBMC.

@kroening
Copy link
Member Author

kroening commented May 9, 2019

#4636 is meant to prepare for b).

@tautschnig
Copy link
Collaborator

@kroening #4636 is merged, so this one should become feasible.

@kroening kroening force-pushed the __float128 branch 2 times, most recently from 89468e3 to d724523 Compare May 12, 2019 14:01
@kroening
Copy link
Member Author

Now there!

@kroening kroening assigned tautschnig and unassigned kroening May 13, 2019
@kroening
Copy link
Member Author

BTW, checking the gcc version will cost some performance. A viable alternative is to simply assume a version of gcc >=7, which is the case now for all major distributions.

// ISO/IEC TS 18661-3:2015 support was introduced with gcc 7.0
if(
gcc_version.flavor == gcc_versiont::flavort::GCC &&
gcc_version.is_at_least(7))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit pick: below there's always an explicit u suffix, so should this be used here as well? I'd just like to see consistency.

@tautschnig tautschnig assigned kroening and unassigned tautschnig May 13, 2019
Daniel Kroening added 2 commits May 15, 2019 08:15
_Float128 is a keyword, defined in ISO/IEC TS 18661-3:2015.
It's a typedef since gcc 6.0.
It's a genuine keyword since gcc 7.0.
clang does not offer it.

__float128 is a typedef in gcc since 4.3/4.5, depending on architecture.

__float128 is a keyword in clang.

This PR attempts to clean this up.
Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

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

⚠️
This PR failed Diffblue compatibility checks (cbmc commit: c5b0bd1).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/111867719
Status will be re-evaluated on next push.
Common spurious failures include: the cbmc commit has disappeared in the mean time (e.g. in a force-push); the author is not in the list of contributors (e.g. first-time contributors); compatibility was already broken by an earlier merge.

Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

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

✔️
Passed Diffblue compatibility checks (cbmc commit: c937b3f).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/111868662

@tautschnig tautschnig merged commit 0a6af1e into develop May 15, 2019
@tautschnig tautschnig deleted the __float128 branch May 15, 2019 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants