Closed Bug 1363009 Opened 8 years ago Closed 8 years ago

Vector.h: fails to build with gcc 7 on -Werror=strict-aliasing

Categories

(Core :: MFBT, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: Sylvestre, Assigned: andi)

References

Details

Attachments

(1 file)

^~ In file included from /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ArrayUtils.h:14:0, from /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/mozilla/RangedPtr.h:15, from /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/mozilla/Range.h:10, from /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/js/CharacterEncoding.h:10, from /root/firefox-gcc-last/js/src/jscntxt.h:14, from /root/firefox-gcc-last/js/src/vm/RegExpObject.h:15, from /root/firefox-gcc-last/js/src/builtin/RegExp.h:10, from /root/firefox-gcc-last/js/src/builtin/RegExp.cpp:7: /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/mozilla/Vector.h: In instantiation of 'mozilla::Vector<T, N, AllocPolicy>::~Vector() [with T = JS::Value; long unsigned int MinInlineCapacity = 8; AllocPolicy = js::TempAllocPolicy]': /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/js/GCVector.h:36:7: required from here /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/mozilla/Vector.h:831:45: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] MOZ_ASSERT_IF(usingInlineStorage(), mTail.mCapacity == kInlineCapacity); \ ~~~~~~^ /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/mozilla/Assertions.h:402:69: note: in definition of macro 'MOZ_VALIDATE_ASSERT_CONDITION_TYPE' static_assert(mozilla::detail::AssertionConditionType<decltype(x)>::isValid, \ ^ /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/mozilla/Assertions.h:435:39: note: in expansion of macro 'MOZ_ASSERT_HELPER1' #define MOZ_RELEASE_ASSERT_GLUE(a, b) a b ^ /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/mozilla/Assertions.h:437:3: note: in expansion of macro 'MOZ_RELEASE_ASSERT_GLUE' MOZ_RELEASE_ASSERT_GLUE( \ ^~~~~~~~~~~~~~~~~~~~~~~ /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/mozilla/Assertions.h:442:27: note: in expansion of macro 'MOZ_RELEASE_ASSERT' # define MOZ_ASSERT(...) MOZ_RELEASE_ASSERT(__VA_ARGS__) ^~~~~~~~~~~~~~~~~~ /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/mozilla/Assertions.h:466:10: note: in expansion of macro 'MOZ_ASSERT' MOZ_ASSERT(expr); \ ^~~~~~~~~~ /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/mozilla/Vector.h:831:3: note: in expansion of macro 'MOZ_ASSERT_IF' MOZ_ASSERT_IF(usingInlineStorage(), mTail.mCapacity == kInlineCapacity); \ ^~~~~~~~~~~~~ /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/mozilla/Vector.h:904:3: note: in expansion of macro 'MOZ_REENTRANCY_GUARD_ET_AL' MOZ_REENTRANCY_GUARD_ET_AL; ^~~~~~~~~~~~~~~~~~~~~~~~~~
Assignee: nobody → bpostelnicu
Do we support -fstrict-aliasing?
Most likely we shouldn't compile this with -fstrict-aliasing, I think we should use: -fno-strict-aliasing
More info can be found here why we don't support yet strict-aliasing: https://bugzilla.mozilla.org/show_bug.cgi?id=414641
ok, we should disable this option for real then and for everyone
Comment on attachment 8868073 [details] Bug 1363009 - disable strict-aliasing for gcc in js/src. Sorry I am not comfortable reviewing this; maybe a build peer would be more appropriate here.
Attachment #8868073 - Flags: review?(bbouvier)
Attachment #8868073 - Flags: review?(sphink)
Comment on attachment 8868073 [details] Bug 1363009 - disable strict-aliasing for gcc in js/src. https://reviewboard.mozilla.org/r/139686/#review144258 A little sad, but I agree with the change.
Attachment #8868073 - Flags: review?(sphink) → review+
Pushed by bpostelnicu@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/48ff50f0db50 disable strict-aliasing for gcc in js/src. r=sfink
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Blocks: 1366497
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: