Last Comment Bug 783505 - OS X gcc builds failing with "jstypedarray.cpp:1427: error: template parameter 'ValueGetter' of type 'JS::Value (*)(JSObject*)' is not allowed in an integral constant expression because it is not of integral or enumeration type"
: OS X gcc builds failing with "jstypedarray.cpp:1427: error: template paramete...
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: Trunk
: x86_64 Mac OS X
: -- major (vote)
: ---
Assigned To: Rafael Ávila de Espíndola (:espindola) (not reading bugmail)
:
Mentors:
Depends on:
Blocks: 777174 781562
  Show dependency treegraph
 
Reported: 2012-08-17 02:50 PDT by Ed Morley [:emorley]
Modified: 2012-10-01 07:16 PDT (History)
14 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
fix gcc 4.2 build. (830 bytes, patch)
2012-08-17 12:54 PDT, Rafael Ávila de Espíndola (:espindola) (not reading bugmail)
jorendorff: review+
Details | Diff | Review

Description Ed Morley [:emorley] 2012-08-17 02:50:52 PDT
Latest birch (where we ensure OS X still builds with gcc, now that trunk has switched to clang) merge is failing with:

{
../../../../js/src/jstypedarray.cpp:1427: error: template parameter 'ValueGetter' of type 'JS::Value (*)(JSObject*)' is not allowed in an integral constant expression because it is not of integral or enumeration type
}

https://hg.mozilla.org/projects/birch/pushloghtml?startID=117&endID=118

-> bug 777174
Comment 1 Ed Morley [:emorley] 2012-08-17 04:12:53 PDT
Also:
B2G macosx64_gecko mozilla-central nightly
https://tbpl.mozilla.org/php/getParsedLog.php?id=14463451&tree=Firefox

{
/builds/slave/m-cen-osx64-gecko-ntly/build/js/src/jstypedarray.cpp: In static member function 'static JSBool TypedArrayTemplate<NativeType>::Getter(JSContext*, unsigned int, JS::Value*)':
/builds/slave/m-cen-osx64-gecko-ntly/build/js/src/jstypedarray.cpp:1427: error: template parameter 'ValueGetter' of type 'JS::Value (*)(JSObject*)' is not allowed in an integral constant expression because it is not of integral or enumeration type
}

Are B2G builds supposed to be using gcc?
Comment 2 Ed Morley [:emorley] 2012-08-17 04:13:33 PDT
CCing espindola for last part of comment 1.
Comment 3 Rafael Ávila de Espíndola (:espindola) (not reading bugmail) 2012-08-17 09:40:58 PDT
It looks like this was caused by 777174. The problem reduces to gcc 4.2 not accepting

typedef bool (*NativeImpl)();
template<NativeImpl Impl> inline bool CallNonGenericMethod() {
}
template<typename NativeType> class TypedArrayTemplate  {
  typedef TypedArrayTemplate<NativeType> ThisTypeArray;
  template<int ValueGetter()>
  static bool     GetterImpl()     {
    return CallNonGenericMethod<  ThisTypeArray::GetterImpl<ValueGetter> >();
  }
};
Comment 4 Rafael Ávila de Espíndola (:espindola) (not reading bugmail) 2012-08-17 11:46:52 PDT
git bisect found this to be fixed by http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39608. Which is strange, since is marked as a regression fix. Looking a bit more to see if there is a way to avoid the bug.
Comment 5 Rafael Ávila de Espíndola (:espindola) (not reading bugmail) 2012-08-17 12:54:49 PDT
Created attachment 652883 [details] [diff] [review]
fix gcc 4.2 build.
Comment 6 Rafael Ávila de Espíndola (:espindola) (not reading bugmail) 2012-08-17 13:02:17 PDT
I pushed the patch + a hack to use gcc 4.2 to
https://tbpl.mozilla.org/?tree=Try&rev=3c393fe37a76
Comment 7 Landry Breuil (:gaston) 2012-08-20 00:15:25 PDT
Fwiw att #652883 fixes my openbsd/gcc 4.2 builds too.
Comment 8 Jason Orendorff [:jorendorff] 2012-08-20 07:19:16 PDT
Comment on attachment 652883 [details] [diff] [review]
fix gcc 4.2 build.

Review of attachment 652883 [details] [diff] [review]:
-----------------------------------------------------------------

Oh, I don't know that that hack is "really bad". It's the circumstances that are bad; the workaround is sensible enough.

r=me.
Comment 9 Rafael Ávila de Espíndola (:espindola) (not reading bugmail) 2012-08-20 07:30:21 PDT
https://tbpl.mozilla.org/?tree=Mozilla-Inbound&rev=4d76ec905c11
Comment 10 Landry Breuil (:gaston) 2012-08-21 02:14:45 PDT
https://hg.mozilla.org/integration/mozilla-inbound/rev/4d76ec905c11
http://hg.mozilla.org/mozilla-central/rev/3a0f4470276f

not 100% sure but i think this one can be marked as fixed. my openbsd/gcc 4.2 builds are green again.
Comment 11 Ed Morley [:emorley] 2012-08-21 02:16:55 PDT
As is birch (our gcc osx builds) :-)
https://tbpl.mozilla.org/?tree=Birch&rev=716b48dbafe3
Comment 12 Ed Morley [:emorley] 2012-08-21 06:32:15 PDT
https://hg.mozilla.org/mozilla-central/rev/4d76ec905c11
Comment 13 John Ford [:jhford] 2012-08-21 09:22:57 PDT
This has also fixed the OS X nightly builds
Comment 14 Rafael Ávila de Espíndola (:espindola) (not reading bugmail) 2012-08-21 09:39:34 PDT
(In reply to John Ford [:jhford] from comment #13)
> This has also fixed the OS X nightly builds

Are they using gcc? :-(
What mozconfig are they using. They should have switched to clang.
Comment 15 Eric Promislow 2012-09-25 14:04:47 PDT
The original code fails to compile with gcc 4.3.2 on Linux (Fedora release 10 (Cambridge))

I got it to compile by changing the "2" in the patch to a "3"
Comment 16 Rafael Ávila de Espíndola (:espindola) (not reading bugmail) 2012-10-01 07:16:22 PDT
(In reply to Eric Promislow from comment #15)
> The original code fails to compile with gcc 4.3.2 on Linux (Fedora release
> 10 (Cambridge))
> 
> I got it to compile by changing the "2" in the patch to a "3"

Oops. Sorry about that.  The ifdef was removed on bug 784029.

Note You need to log in before you can comment on or make changes to this bug.