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

Weird error building rakudo #930

Closed
p6rt opened this issue Apr 21, 2009 · 6 comments
Closed

Weird error building rakudo #930

p6rt opened this issue Apr 21, 2009 · 6 comments

Comments

@p6rt
Copy link

p6rt commented Apr 21, 2009

Migrated from rt.perl.org#64930 (status was 'resolved')

Searchable as RT64930$

@p6rt
Copy link
Author

p6rt commented Apr 21, 2009

From paco.linux@gmail.com

Hi​:

I'm having a very weird error while building latest rakudo with parrot
r38208 (gcc 4.1.3 20070929) :

cc -c -o perl6_ops_cg.o -I/tmp/rakudo/parrot/include
-I/tmp/rakudo/parrot/src/pmc -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS
-DDEBIAN -pipe -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -DHASATTRIBUTE_CONST -DHASATTRIBUTE_DEPRECATED
-DHASATTRIBUTE_MALLOC -DHASATTRIBUTE_NONNULL -DHASATTRIBUTE_NORETURN
-DHASATTRIBUTE_PURE -DHASATTRIBUTE_UNUSED
-DHASATTRIBUTE_WARN_UNUSED_RESULT -falign-functions=16 -fvisibility=hidden
-funit-at-a-time -maccumulate-outgoing-args -W -Wall -Waggregate-return
-Wcast-align -Wcast-qual -Wchar-subscripts -Wcomment -Wdisabled-optimization
-Wendif-labels -Wextra -Wformat -Wformat-extra-args -Wformat-nonliteral
-Wformat-security -Wformat-y2k -Wimplicit -Wimport -Winit-self -Winline
-Winvalid-pch -Wmissing-braces -Wmissing-field-initializers
-Wno-missing-format-attribute -Wmissing-include-dirs -Wpacked -Wparentheses
-Wpointer-arith -Wreturn-type -Wsequence-point -Wno-shadow -Wsign-compare
-Wstrict-aliasing -Wstrict-aliasing=2 -Wswitch -Wswitch-default -Wtrigraphs
-Wundef -Wunknown-pragmas -Wno-unused -Wvariadic-macros -Wwrite-strings
-Wbad-function-cast -Wc++-compat -Wdeclaration-after-statement
-Wimplicit-function-declaration -Wimplicit-int -Wmain -Wmissing-declarations
-Wmissing-prototypes -Wnested-externs -Wnonnull -Wold-style-definition
-Wstrict-prototypes -DHAS_GETTEXT -fPIC -g -DHAS_JIT -DI386
-DHAVE_COMPUTED_GOTO perl6_ops_cg.c
perl6.ops​: In function 'cg_perl6'​:
perl6.ops​:128​: warning​: assignment discards qualifiers from pointer target
type
perl6.ops​:128​: warning​: assignment discards qualifiers from pointer target
type
perl6.ops​:218​: error​: unable to find a register to spill in class 'SIREG'
perl6.ops​:218​: error​: this is the insn​:
(insn 2620 2619 2621 138 perl6.ops​:151 (parallel [
  (set (reg​:CC 17 flags)
  (compare​:CC (mem​:BLK (reg/f​:SI 3049 [ cstr ]) [0 A8])
  (mem/s/j​:BLK (reg/f​:SI 3050) [0 A8])))
  (use (reg​:SI 3051))
  (use (const_int 1 [0x1]))
  (use (reg​:SI 19 dirflag))
  (clobber (reg/f​:SI 3049 [ cstr ]))
  (clobber (reg/f​:SI 3050))
  (clobber (reg​:SI 3051))
  ]) 720 {*cmpstrnqi_nz_1} (nil)
  (expr_list​:REG_UNUSED (reg​:SI 3051)
  (expr_list​:REG_UNUSED (reg/f​:SI 3050)
  (expr_list​:REG_UNUSED (reg/f​:SI 3049 [ cstr ])
  (expr_list​:REG_DEAD (reg​:SI 19 dirflag)
  (expr_list​:REG_DEAD (reg​:SI 3051)
  (expr_list​:REG_DEAD (reg/f​:SI 3049 [ cstr ])
  (expr_list​:REG_DEAD (reg/f​:SI 3050)
  (expr_list​:REG_UNUSED (reg​:SI 3051)
  (expr_list​:REG_UNUSED (reg/f​:SI 3050)
  (expr_list​:REG_UNUSED (reg/f​:SI 3049
[ cstr ])
  (nil))))))))))))
perl6.ops​:218​: confused by earlier errors, bailing out

In /parrot/languages/rakudo/src/ops/perl6.ops there is this comment :

73 /* Using memcpy here may trigger gcc optimizations, which at
this point
74 * can wreak havoc on register-starved x86​:
75 * error​: unable to find a register to spill in class 'SIREG'
76 * Use memmove instead, which is slower, but isn't inlined by
gcc. */

I have tried in other machines and have no problem, so I think is a problem
of this version of gcc

paco@​javier​:/tmp/rakudo$ gcc --version
gcc (GCC) 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

The problem went away using other switches while compiling rakudo (using
--optimize) and the spectest :

All tests successful.
Files=373, Tests=12884, 909 wallclock secs (10.10 usr 1.25 sys + 1605.36
cusr 59.56 csys = 1676.27 CPU)
Result​: PASS

/rakudo/parrot$ cat myconfig
Summary of my parrot 1.0.0 (r38208) configuration​:
  configdate='Tue Apr 21 13​:52​:08 2009 GMT'
  Platform​:
  osname=linux, archname=i486-linux-gnu-thread-multi
  jitcapable=1, jitarchname=i386-linux,
  jitosname=LINUX, jitcpuarch=i386
  execcapable=1
  perl=/usr/bin/perl
  Compiler​:
  cc='cc', ccflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS
-DDEBIAN -pipe -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -DHASATTRIBUTE_CONST -DHASATTRIBUTE_DEPRECATED
-DHASATTRIBUTE_MALLOC -DHASATTRIBUTE_NONNULL -DHASATTRIBUTE_NORETURN
-DHASATTRIBUTE_PURE -DHASATTRIBUTE_UNUSED
-DHASATTRIBUTE_WARN_UNUSED_RESULT -falign-functions=16 -fvisibility=hidden
-funit-at-a-time -maccumulate-outgoing-args -W -Wall -Waggregate-return
-Wcast-align -Wcast-qual -Wchar-subscripts -Wcomment -Wdisabled-optimization
-Wendif-labels -Wextra -Wformat -Wformat-extra-args -Wformat-nonliteral
-Wformat-security -Wformat-y2k -Wimplicit -Wimport -Winit-self -Winline
-Winvalid-pch -Wmissing-braces -Wmissing-field-initializers
-Wno-missing-format-attribute -Wmissing-include-dirs -Wpacked -Wparentheses
-Wpointer-arith -Wreturn-type -Wsequence-point -Wno-shadow -Wsign-compare
-Wstrict-aliasing -Wstrict-aliasing=2 -Wswitch -Wswitch-default -Wtrigraphs
-Wundef -Wunknown-pragmas -Wno-unused -Wvariadic-macros -Wwrite-strings
-Wbad-function-cast -Wc++-compat -Wdeclaration-after-statement
-Wimplicit-function-declaration -Wimplicit-int -Wmain -Wmissing-declarations
-Wmissing-prototypes -Wnested-externs -Wnonnull -Wold-style-definition
-Wstrict-prototypes -DHAS_GETTEXT',
  Linker and Libraries​:
  ld='cc', ldflags=' -L/usr/local/lib',
  cc_ldflags='',
  libs='-ldl -lm -lpthread -lcrypt -lgmp -lreadline '
  Dynamic Linking​:
  share_ext='.so', ld_share_flags='-shared -L/usr/local/lib -fPIC',
  load_ext='.so', ld_load_flags='-shared -L/usr/local/lib -fPIC'
  Types​:
  iv=long, intvalsize=4, intsize=4, opcode_t=long, opcode_t_size=4,
  ptrsize=4, ptr_alignment=1 byteorder=1234,
  nv=double, numvalsize=8, doublesize=8, longdoublesize=12

Paco

--
|_|0|_|
|_|_|0|
|0|0|0|

@p6rt
Copy link
Author

p6rt commented May 9, 2009

From @jeffhorwitz

I've reproduced this problem on my machine (CentOS 5, x86 VMware ESX,
gcc 4.1.2). No solution yet, but here's my analysis.

Building Rakudo with ICU enabled on x86 (gcc 4.1.2) results in the
following error​:

perl6.ops​: In function cg_perl6​:
perl6.ops​:218​: error​: unable to find a register to spill in class SIREG
perl6.ops​:218​: error​: this is the insn​:
(insn 2620 2619 2621 138 perl6.ops​:152 (parallel [
  (set (reg​:CC 17 flags)
  (compare​:CC (mem​:BLK (reg/f​:SI 3049 [ cstr ]) [0 A8])
  (mem/s/j​:BLK (reg/f​:SI 3050) [0 A8])))
  (use (reg​:SI 3051))
  (use (const_int 1 [0x1]))
  (use (reg​:SI 19 dirflag))
  (clobber (reg/f​:SI 3049 [ cstr ]))
  (clobber (reg/f​:SI 3050))
  (clobber (reg​:SI 3051))
  ]) 535 {*cmpstrnqi_nz_1} (nil)
  (expr_list​:REG_UNUSED (reg​:SI 3051)
  (expr_list​:REG_UNUSED (reg/f​:SI 3050)
  (expr_list​:REG_UNUSED (reg/f​:SI 3049 [ cstr ])
  (expr_list​:REG_DEAD (reg​:SI 19 dirflag)
  (expr_list​:REG_DEAD (reg​:SI 3051)
  (expr_list​:REG_DEAD (reg/f​:SI 3049 [ cstr ])
  (expr_list​:REG_DEAD (reg/f​:SI 3050)
  (expr_list​:REG_UNUSED (reg​:SI 3051)
  (expr_list​:REG_UNUSED (reg/f​:SI
3050)
  (expr_list​:REG_UNUSED (reg/f​:SI
3049 [ cstr ])
  (nil))))))))))))
perl6.ops​:218​: confused by earlier errors, bailing out

==========

This output is similar to the memcpy issue I patched in the same file
last
November, but this is a separate issue. The error indicates the problem
lies at (or around) line 152 in perl6.ops, which is in the "is_uprop"
op.
The offending code is only compiled if PARROT_HAS_ICU is defined, and
the
error occurs when compiling the CG core (no surprise there).

135 inline op is_uprop(out INT, in STR, in STR, in INT) :base_core {
136 #if PARROT_HAS_ICU
137 char *cstr;
138 INTVAL ord;
139 int32_t strwhich, ordwhich;
140 UProperty strprop;
141 opcode_t *handler;
142
143 if ($4 > 0 && (UINTVAL)$4 == ($3->strlen)) {
144 $1 = 0;
145 goto NEXT();
146 }
147
148 ord = string_ord(interp, $3, $4);
149 cstr = Parrot_str_to_cstring(interp, $2);
150
151 /* try block tests */
152 if (strncmp(cstr, "In", 2) == 0) {
153 strwhich = u_getPropertyValueEnum(UCHAR_BLOCK, cstr+2);
154 ordwhich = u_getIntPropertyValue(ord, UCHAR_BLOCK);
155 if (strwhich != UCHAR_INVALID_CODE) {
156 $1 = (strwhich == ordwhich);
157 Parrot_str_free_cstring(cstr);
158 goto NEXT();
159 }
160 }

There is likely some compiler optimization going on in that block that
we need to work around, but it's not entirely clear what it is.
Disabling ICU in Parrot will allow you to compile Rakudo for the time
being, but that's not a solution.

@p6rt
Copy link
Author

p6rt commented May 9, 2009

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented May 17, 2009

From he@uninett.no

On Tir. 21. Apr. 2009 07​:41​:21, PacoLinux wrote​:

Hi​:

I'm having a very weird error while building latest rakudo with parrot
r38208 (gcc 4.1.3 20070929) :

I'm seeing the same problem with gcc version 4.1.2 20061021 prerelease
(NetBSD nb3 20061125), i.e. the system compiler on NetBSD/i386 4.0.

In my case, I found out that what caused the error was not optimization,
but a lack of optimization -- you'll see that the gcc invocation does
not specify any -O option. After some hints from the friendly souls on
#parrot, I found out a way to work around this problem​:

  perl ./Configure.pl --gen-parrot --gen-parrot-option=--optimize

in the rakudo root directory. That way, the relevant file gets compiled
with optimization (together with most if not all the others...), and the
build completes and produces a perl6 executable which so far is working
for me (running spectests now).

Yes, this is actually a gcc bug...

Hope this helps,

- Håvard

@p6rt
Copy link
Author

p6rt commented Jun 3, 2009

From @jnthn

On Sun May 17 12​:16​:57 2009, heidnes wrote​:

On Tir. 21. Apr. 2009 07​:41​:21, PacoLinux wrote​:

Hi​:

I'm having a very weird error while building latest rakudo with parrot
r38208 (gcc 4.1.3 20070929) :

I'm seeing the same problem with gcc version 4.1.2 20061021 prerelease
(NetBSD nb3 20061125), i.e. the system compiler on NetBSD/i386 4.0.

In my case, I found out that what caused the error was not optimization,
but a lack of optimization -- you'll see that the gcc invocation does
not specify any -O option. After some hints from the friendly souls on
#parrot, I found out a way to work around this problem​:

perl ./Configure.pl --gen-parrot --gen-parrot-option=--optimize

in the rakudo root directory. That way, the relevant file gets compiled
with optimization (together with most if not all the others...), and the
build completes and produces a perl6 executable which so far is working
for me (running spectests now).

Yes, this is actually a gcc bug...

Yup, and there's no obvious workaround we can do in the code. So, going
to close this ticket as resolved since we have a good enough workaround,
and I did add to the Get Rakudo page at​:
http://www.rakudo.org/how-to-get-rakudo
Where hopefully people will notice it and be able to work around it.

Thanks,

Jonathan

@p6rt
Copy link
Author

p6rt commented Jun 3, 2009

@jnthn - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Jun 3, 2009
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant