Bug 86944 - glsl_parser_extras.cpp", line 1455: Error: Badly formed expression. (Oracle Studio)
Summary: glsl_parser_extras.cpp", line 1455: Error: Badly formed expression. (Oracle S...
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: git
Hardware: x86 (IA32) Solaris
: medium blocker
Assignee: mesa-dev
QA Contact:
URL:
Whiteboard:
Keywords: bisected, regression
Depends on:
Blocks:
 
Reported: 2014-12-02 22:19 UTC by Vinson Lee
Modified: 2016-07-09 00:10 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vinson Lee 2014-12-02 22:19:42 UTC
mesa: 4e6244e80f7dd6dad526ff04f5103ed24d61d38a (master 10.5.0-devel)

Build error with Oracle Studio.

$ gmake
[...]
"../../src/glsl/glsl_parser_extras.cpp", line 58: Warning: stage hides _mesa_glsl_parse_state::stage.
"../../src/glsl/glsl_parser_extras.cpp", line 864: Warning: new_scope hides ast_compound_statement::new_scope.
"../../src/glsl/glsl_parser_extras.cpp", line 865: Warning: statements hides ast_compound_statement::statements.
"../../src/glsl/glsl_parser_extras.cpp", line 998: Warning: oper hides ast_expression::oper.
"../../src/glsl/glsl_parser_extras.cpp", line 1090: Warning: identifier hides ast_declaration::identifier.
"../../src/glsl/glsl_parser_extras.cpp", line 1091: Warning: array_specifier hides ast_declaration::array_specifier.
"../../src/glsl/glsl_parser_extras.cpp", line 1092: Warning: initializer hides ast_declaration::initializer.
"../../src/glsl/glsl_parser_extras.cpp", line 1123: Warning: type hides ast_declarator_list::type.
"../../src/glsl/glsl_parser_extras.cpp", line 1154: Warning: mode hides ast_jump_statement::mode.
"../../src/glsl/glsl_parser_extras.cpp", line 1181: Warning: condition hides ast_selection_statement::condition.
"../../src/glsl/glsl_parser_extras.cpp", line 1182: Warning: then_statement hides ast_selection_statement::then_statement.
"../../src/glsl/glsl_parser_extras.cpp", line 1183: Warning: else_statement hides ast_selection_statement::else_statement.
"../../src/glsl/glsl_parser_extras.cpp", line 1202: Warning: test_expression hides ast_switch_statement::test_expression.
"../../src/glsl/glsl_parser_extras.cpp", line 1203: Warning: body hides ast_switch_statement::body.
"../../src/glsl/glsl_parser_extras.cpp", line 1221: Warning: stmts hides ast_switch_body::stmts.
"../../src/glsl/glsl_parser_extras.cpp", line 1239: Warning: test_value hides ast_case_label::test_value.
"../../src/glsl/glsl_parser_extras.cpp", line 1269: Warning: labels hides ast_case_statement::labels.
"../../src/glsl/glsl_parser_extras.cpp", line 1329: Warning: mode hides ast_iteration_statement::mode.
"../../src/glsl/glsl_parser_extras.cpp", line 1331: Warning: condition hides ast_iteration_statement::condition.
"../../src/glsl/glsl_parser_extras.cpp", line 1332: Warning: rest_expression hides ast_iteration_statement::rest_expression.
"../../src/glsl/glsl_parser_extras.cpp", line 1333: Warning: body hides ast_iteration_statement::body.
"../../src/glsl/glsl_parser_extras.cpp", line 1455: Error: Badly formed expression.


commit 9db278d0e2b3bf35b28f00ab7ec3392443aae6b3
Author: Matt Turner <mattst88@gmail.com>
Date:   Fri Nov 21 18:04:21 2014 -0800

    glsl: Initialize static temporaries_allocate_names once per process.
    
    Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Comment 1 Matt Turner 2014-12-03 00:42:48 UTC
(In reply to Vinson Lee from comment #0)
> Build error with Oracle Studio.
> 
> [snip useless warnings]
> "../../src/glsl/glsl_parser_extras.cpp", line 1455: Error: Badly formed
> expression.

I'm not sure what's wrong with 

+      (void) p_atomic_cmpxchg(&ir_variable::temporaries_allocate_names,
+                              false, true);

gcc and MSVC seem to accept it.
Comment 2 Matt Turner 2014-12-03 00:45:16 UTC
Oh, I bet there's something wrong with the macro. I'd try removing the typeof(*v) cast in src/util/u_atomic.h around line 173. If that fixes it, we should remove those casts from p_atomic_inc_return and p_atomic_dec_return as well.
Comment 3 Vinson Lee 2014-12-06 07:53:12 UTC
(In reply to Matt Turner from comment #2)
> Oh, I bet there's something wrong with the macro. I'd try removing the
> typeof(*v) cast in src/util/u_atomic.h around line 173. If that fixes it, we
> should remove those casts from p_atomic_inc_return and p_atomic_dec_return
> as well.

I removed the typeof(*v) cast in u_atomic.h:173. The build gets further and hits a different build error.

diff --git a/src/util/u_atomic.h b/src/util/u_atomic.h
index 56c5740..afe1b90 100644
--- a/src/util/u_atomic.h
+++ b/src/util/u_atomic.h
@@ -170,7 +170,7 @@
    sizeof(*v) == sizeof(uint64_t) ? atomic_dec_64_nv((uint64_t *)(v)) : \
                                     (assert(!"should not get here"), 0))
 
-#define p_atomic_cmpxchg(v, old, _new) ((typeof(*v)) \
+#define p_atomic_cmpxchg(v, old, _new) ( \
    sizeof(*v) == sizeof(uint8_t)  ? atomic_cas_8 ((uint8_t  *)(v), (uint8_t )(old), (uint8_t )(_new)) : \
    sizeof(*v) == sizeof(uint16_t) ? atomic_cas_16((uint16_t *)(v), (uint16_t)(old), (uint16_t)(_new)) : \
    sizeof(*v) == sizeof(uint32_t) ? atomic_cas_32((uint32_t *)(v), (uint32_t)(old), (uint32_t)(_new)) : \


"../../src/gallium/include/pipe/p_compiler.h", line 73: warning: typedef redeclared: uint
"../../src/gallium/include/pipe/p_compiler.h", line 75: warning: typedef redeclared: ushort
"../../src/gallium/auxiliary/util/u_inlines.h", line 83: operands have incompatible types:
         void ":" int
Comment 4 Brian Paul 2014-12-12 21:22:28 UTC
Vinson, can you see if commit e75e677d288e67c3c05e7b8744e08cd73bdcbed8 fixes this?
Comment 5 Vinson Lee 2014-12-12 22:26:30 UTC
(In reply to Brian Paul from comment #4)
> Vinson, can you see if commit e75e677d288e67c3c05e7b8744e08cd73bdcbed8 fixes
> this?

No, it does not fix the build error.
Comment 6 Vinson Lee 2014-12-15 22:02:42 UTC
6df72e970c0e2794a5651f7141528baa51c0c491 is the first bad commit
commit 6df72e970c0e2794a5651f7141528baa51c0c491
Author: Matt Turner <mattst88@gmail.com>
Date:   Fri Nov 21 16:33:40 2014 -0800

    util: Make u_atomic.h typeless.
    
    like how C11's stdatomic.h provides generic functions. GCC's __sync_*
    builtins already take a variety of types, so that's simple.
    
    MSVC and Sun Studio don't, but we can implement it with something that
    looks a little crazy but is actually quite readable.
    
    Thanks to Jose for some MSVC fixes!
    
    Reviewed-by: Jose Fonseca <jfonseca@vmware.com>

:040000 040000 73eaf29780b62a66a3e97232db35e10156d22638 5724f16275b0fc76ee6f5c1e26e262406738ed4a M      src
bisect run success
Comment 7 Jose Fonseca 2014-12-17 16:32:52 UTC
Vinson

I think Brian's recent 241c599cb109d022ab44aa84ad823ca7a13b32fa commit should have helped with this.
Comment 8 Vinson Lee 2014-12-17 17:40:32 UTC
(In reply to José Fonseca from comment #7)
> 
> I think Brian's recent 241c599cb109d022ab44aa84ad823ca7a13b32fa commit
> should have helped with this.

Build is still broken with latest master.

mesa: bc18b48924f9acc9999643193ad04694d7baaaeb (master 10.5.0-devel)

"../../src/glsl/glsl_parser_extras.cpp", line 1455: Error: Badly formed expression.
Comment 9 Jose Fonseca 2014-12-17 19:03:16 UTC
> Build error with Oracle Studio.

Just realized this is not with MSVC.
Comment 10 Ian Romanick 2015-02-11 23:04:32 UTC
Is this still an issue?
Comment 11 Vinson Lee 2015-02-12 01:38:43 UTC
(In reply to Ian Romanick from comment #10)
> Is this still an issue?

Yes, this is still an issue.

mesa: cba6a4a12943d635e8dd3d38d94e21cbcab8be34 (master 10.6.0-devel)

"glsl_parser_extras.cpp", line 1457: Error: Badly formed expression.
Comment 12 Alan Coopersmith 2015-02-17 21:25:20 UTC
http://patchwork.freedesktop.org/patch/42582/ fixes this for me when
building with Solaris Studio 12.4 compilers.
Comment 13 Ian Romanick 2015-02-18 17:12:41 UTC
Should be fixed by:

commit 4671dca0eecf7dbf3e0d0a13111813756722d57d
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date:   Sun Feb 15 16:19:06 2015 -0800

    Use __typeof instead of typeof with Solaris Studio compilers
    
    While the C compiler accepts typeof, C++ requires __typeof.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=86944
    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Cc: "10.5" <mesa-stable@lists.freedesktop.org>
    Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
    Reviewed-by: Brian Paul <brianp@vmware.com>

Please reopen if it is still a problem.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct.