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

Remove disabling -Warray-bounds for GCC in FBString.h #999

Closed

Conversation

JoeLoser
Copy link
Contributor

Summary:

  • Existing code disables -Warray-bounds warning for GCC due to a bug in
    GCC 4.9.
  • As seen in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59124, the bug
    has been resolved for GCC 5.1.
  • Since the bug has been resolved, we no longer need to disable the
    warning.

@yfeldblum I suspect that we have to hold off on this PR until the internal use cases relying on GCC 4.9 upgrade, but I figured it is better to have some of these cleanup opportunities ready for when the time arises.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@yfeldblum has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@JoeLoser
Copy link
Contributor Author

@yfeldblum does this PR also have to wait until the remaining internal uses of GCC 4.9 move on to GCC 5+?

@JoeLoser
Copy link
Contributor Author

Ping @lbrandy in case this is blocked in the internal review as well. Would appreciate the review.

Last I heard from @yfeldblum, there were a few internal things relying on GCC 4.9, so we may not quite be able to land this PR until they move over to GCC 5+. Let me know if that is the case so we can proceed accordingly.

@yfeldblum
Copy link
Contributor

Hey @JoeLoser, there is some internal build configuration which I think is gcc5 but which doesn't agree and is showing build-time failures that I don't quite understand it yet.

folly/FixedString.h:145:13: error: array subscript is above array bounds [-Werror=array-bounds]
       ? left[i]
             ^

@yfeldblum
Copy link
Contributor

Also fwiw, I don't see anything internally atm which still uses gcc49 depending on this.

@JoeLoser
Copy link
Contributor Author

Thanks for the update and looking into this a bit @yfeldblum. After rereading some of the comments on the GCC bug report (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59124), my takeaway was that that bug is "mostly fixed" in what made the GCC 5 branch, but there are some lingering issues with it that remain even in GCC 8 (but were fine in GCC 6/7).

If we're hitting one of those cases that have not yet been fixed, it seems like we should keep the disabling of the warning in, but not bound it to GCC versions 5 or less (https://github.com/facebook/folly/pull/999/files#diff-614a0f21886a05769b4e7c183635055aL105)

@yfeldblum
Copy link
Contributor

Yeah that's fine. At least keep the suppression in FixedString.h but we can try removing the suppression only in FBString.h. Want to update the PR?

Summary:
- Existing code disables `-Warray-bounds` warning for GCC due to a bug in
  GCC 4.9.
- As seen in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59124, the bug
  has been resolved for GCC 5.1.
- Since the bug has been resolved, we no longer need to disable the
  warning.
@JoeLoser JoeLoser changed the title Remove disabling -Warray-bounds for GCC in FBString.h and FixedString.h Remove disabling -Warray-bounds for GCC in FBString.h Feb 16, 2019
@JoeLoser
Copy link
Contributor Author

Sure, I kept FixedString.h as is for now. The comments on the separate bug report (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61971) than the one in FBString.h show that this one was fully backported and fixed in GCC 5. But, until we get it to not trip on the internal failure, it seems best to leave FixedString.h untouched.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@yfeldblum has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

sandraiser pushed a commit to sandraiser/folly that referenced this pull request Mar 4, 2019
Summary:
- Existing code disables `-Warray-bounds` warning for GCC due to a bug in
  GCC 4.9.
- As seen in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59124, the bug
  has been resolved for GCC 5.1.
- Since the bug has been resolved, we no longer need to disable the
  warning.

yfeldblum I suspect that we have to hold off on this PR until the internal use cases relying on GCC 4.9 upgrade, but I figured it is better to have some of these cleanup opportunities ready for when the time arises.
Pull Request resolved: facebook#999

Reviewed By: ot, Orvid

Differential Revision: D13729723

Pulled By: yfeldblum

fbshipit-source-id: da33704c2e2022c2dad0681e4d6152105a1cf54d
@JoeLoser JoeLoser deleted the fbstring_array_bounds_gcc49 branch April 2, 2019 01:02
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.

3 participants