Bug 867878 - s390 build fails with Error: Unrecognized opcode: `srak'
Summary: s390 build fails with Error: Unrecognized opcode: `srak'
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: gcc
Version: 6.3
Hardware: s390x
OS: Linux
urgent
urgent
Target Milestone: rc
: ---
Assignee: Jakub Jelinek
QA Contact: qe-baseos-tools
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-10-18 13:34 UTC by Martin Stransky
Modified: 2013-02-21 10:26 UTC (History)
3 users (show)

Fixed In Version: gcc-4.4.7-3.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-02-21 10:26:59 UTC
Target Upstream Version:


Attachments (Terms of Use)
preprocessed c source of hb-ot-shape-fallback.cc (213.12 KB, text/x-c++src)
2012-10-18 13:34 UTC, Martin Stransky
no flags Details


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:0420 normal SHIPPED_LIVE gcc bug fix update 2013-02-20 21:08:01 UTC

Description Martin Stransky 2012-10-18 13:34:49 UTC
Created attachment 629381 [details]
preprocessed c source of hb-ot-shape-fallback.cc

Description of problem:

When building firefox in brew, gcc fails with Error: Unrecognized opcode: `srak'. The same package builds on stable systems. Affects both s390 and s390x.

Complete build log:
http://download.devel.redhat.com/brewroot/work/tasks/2306/4982306/build.log

Gcc command:
c++ -o hb-ot-shape-fallback.o -c -I../../../dist/stl_wrappers -I../../../dist/system_wrappers -include /builddir/build/BUILD/xulrunner-17.0/mozilla-beta/config/gcc_hidden.h -DMOZ_GLUE_IN_PROGRAM -DMOZILLA_INTERNAL_API -D_IMPL_NS_COM -DEXPORT_XPT_API -DEXPORT_XPTC_API -D_IMPL_NS_GFX -D_IMPL_NS_WIDGET -DIMPL_XREAPI -DIMPL_NS_NET -DIMPL_THEBES  -DSTATIC_EXPORTABLE_JS_API -DPACKAGE_VERSION="\"moz\"" -DPACKAGE_BUGREPORT="\"http://bugzilla.mozilla.org/\"" -DHAVE_OT=1 -DHB_NO_MT -I/builddir/build/BUILD/xulrunner-17.0/mozilla-beta/gfx/harfbuzz/src  -I/builddir/build/BUILD/xulrunner-17.0/mozilla-beta/gfx/harfbuzz/src -I. -I../../../dist/include  -I/builddir/build/BUILD/xulrunner-17.0/mozilla-beta/objdir/dist/include/nspr -I/builddir/build/BUILD/xulrunner-17.0/mozilla-beta/objdir/dist/include/nss      -fPIC  -pedantic -Wall -Wpointer-arith -Woverloaded-virtual -Werror=return-type -Wtype-limits -Wempty-body -Wno-ctor-dtor-privacy -Wno-overlength-strings -Wno-invalid-offsetof -Wno-variadic-macros -Wcast-align -Wno-long-long -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fno-exceptions -fstack-protector --param=ssp-buffer-size=4 -m31 -march=z9-109 -mtune=z10 -fpermissive -fno-exceptions -fno-strict-aliasing -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -fshort-wchar -pthread -pipe  -DNDEBUG -DTRIMMED -g -Os -freorder-blocks  -fomit-frame-pointer   -DMOZILLA_CLIENT -include ../../../mozilla-config.h -MD -MF .deps/hb-ot-shape-fallback.o.pp -UDEBUG /builddir/build/BUILD/xulrunner-17.0/mozilla-beta/gfx/harfbuzz/src/hb-ot-shape-fallback.cc
{standard input}: Assembler messages:
{standard input}:131: Error: Unrecognized opcode: `srak'

Version-Release number of selected component (if applicable):

http://download.devel.redhat.com/brewroot/work/tasks/2306/4982306/root.log

gcc                    s390    4.4.6-4.el6
binutils               s390    2.20.51.0.2-5.34.el6

Comment 1 Martin Stransky 2012-10-18 13:38:07 UTC
s390x failure:

Build log: 
http://download.devel.redhat.com/brewroot/work/tasks/1827/4991827/build.log

Root log:
http://download.devel.redhat.com/brewroot/work/tasks/1827/4991827/root.log

gcc command:
c++ -o hb-ot-shape-fallback.o -c -I../../../dist/stl_wrappers -I../../../dist/system_wrappers -include /builddir/build/BUILD/xulrunner-17.0/mozilla-beta/config/gcc_hidden.h -DMOZ_GLUE_IN_PROGRAM -DMOZILLA_INTERNAL_API -D_IMPL_NS_COM -DEXPORT_XPT_API -DEXPORT_XPTC_API -D_IMPL_NS_GFX -D_IMPL_NS_WIDGET -DIMPL_XREAPI -DIMPL_NS_NET -DIMPL_THEBES  -DSTATIC_EXPORTABLE_JS_API -DPACKAGE_VERSION="\"moz\"" -DPACKAGE_BUGREPORT="\"http://bugzilla.mozilla.org/\"" -DHAVE_OT=1 -DHB_NO_MT -I/builddir/build/BUILD/xulrunner-17.0/mozilla-beta/gfx/harfbuzz/src  -I/builddir/build/BUILD/xulrunner-17.0/mozilla-beta/gfx/harfbuzz/src -I. -I../../../dist/include  -I/builddir/build/BUILD/xulrunner-17.0/mozilla-beta/objdir/dist/include/nspr -I/builddir/build/BUILD/xulrunner-17.0/mozilla-beta/objdir/dist/include/nss      -fPIC  -pedantic -Wall -Wpointer-arith -Woverloaded-virtual -Werror=return-type -Wtype-limits -Wempty-body -Wno-ctor-dtor-privacy -Wno-overlength-strings -Wno-invalid-offsetof -Wno-variadic-macros -Wcast-align -Wno-long-long -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fno-exceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -march=z9-109 -mtune=z10 -fpermissive -fno-exceptions -fno-strict-aliasing -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -fshort-wchar -pthread -pipe  -DNDEBUG -DTRIMMED -g -Os -freorder-blocks  -fomit-frame-pointer   -DMOZILLA_CLIENT -include ../../../mozilla-config.h -MD -MF .deps/hb-ot-shape-fallback.o.pp -UDEBUG /builddir/build/BUILD/xulrunner-17.0/mozilla-beta/gfx/harfbuzz/src/hb-ot-shape-fallback.cc
{standard input}: Assembler messages:
{standard input}:134: Error: Unrecognized opcode: `srak'

packages:
gcc                    s390x   4.4.6-4.el6
binutils               s390x   2.20.51.0.2-5.34.el6

Comment 2 Martin Stransky 2012-10-18 13:40:35 UTC
Note: build fine on stable systems with:

gcc-4.4.4-13.el6.s390x
binutils-2.20.51.0.2-5.11.el6.s390x

Comment 6 Martin Stransky 2012-10-18 14:47:44 UTC
Is there any workaround for that? It blocks upcoming Firefox update.

Comment 7 Jakub Jelinek 2012-10-18 14:51:04 UTC
Regression from RHEL 6.0 caused by #633375.

Comment 9 Jakub Jelinek 2012-10-18 15:22:31 UTC
As workaround I guess
 static inline void
 position_cluster (const hb_ot_shape_plan_t *plan,
 		  hb_font_t *font,
 		  hb_buffer_t  *buffer,
 		  unsigned int start,
 		  unsigned int end)
 {
+#ifdef __s390__
+  hb_unicode_general_category_t category;
+#endif
   if (end - start < 2)
     return;
 
   /* Find the base glyph */
   for (unsigned int i = start; i < end; i++)
     if (is_a_ligature (buffer->info[i]) ||
+#ifdef __s390__
+	((category = _hb_glyph_info_get_general_category (&buffer->info[i]))
+	 != HB_UNICODE_GENERAL_CATEGORY_SPACING_MARK
+	 && category != HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK
+	 && category != HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)
+#else
         !(FLAG (_hb_glyph_info_get_general_category (&buffer->info[i])) &
 	  (FLAG (HB_UNICODE_GENERAL_CATEGORY_SPACING_MARK) |
 	   FLAG (HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK) |
- 	   FLAG (HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK))))
+ 	   FLAG (HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)))
+#endif
	)
     {
       position_around_base (plan, font, buffer, i, end);
       break;
     }
 }

(completely untested) might do the trick, that way there will be no right shift
with shift count which is bitwise and.  Or store result of
 _hb_glyph_info_get_general_category into a temporary and do
  __asm ("" : "+r" (category)); on it before doing the FLAG test to prevent gcc from optimizing it.
So basically change the:
         !(FLAG (_hb_glyph_info_get_general_category (&buffer->info[i])) &
line to:
         !(FLAG (({ hb_unicode_general_category_t category = _hb_glyph_info_get_general_category (&buffer->info[i]); __asm ("" : "+g" (category)); category; })) &

Comment 12 Jakub Jelinek 2012-10-19 08:40:55 UTC
Short testcase:
int bar (char);

void
foo (char *x, unsigned int y)
{
  unsigned int i;
  for (i = 0; i < y; i++)
    if (bar (x[i]) || ((1 << (x[i] & 0x7f)) & 0x2314))
      break;
}
gcc -c -O2 -march=z9-109 test.c
should assemble without errors with gcc-4.4.7-3.el6, should fail with gcc-4.4.7-2.el6.  With -march=z196 it should succeed with both.

Comment 13 Martin Stransky 2012-10-26 09:27:16 UTC
The workaround works, thanks!

Comment 16 errata-xmlrpc 2013-02-21 10:26:59 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-0420.html


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