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

-DDEBUGGING -Dusequadmath -Dusethreads builds crash early #15274

Closed
p5pRT opened this issue Apr 14, 2016 · 11 comments
Closed

-DDEBUGGING -Dusequadmath -Dusethreads builds crash early #15274

p5pRT opened this issue Apr 14, 2016 · 11 comments

Comments

@p5pRT
Copy link

p5pRT commented Apr 14, 2016

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

Searchable as RT127894$

@p5pRT
Copy link
Author

p5pRT commented Apr 14, 2016

From @tonycoz

tony@​mars​:.../git/perl$ git describe
v5.24.0-RC1
tony@​mars​:.../git/perl$ ./Configure -des -DDEBUGGING -Dusequadmath -Dusethreads -Doptimize=-ggdb3\ -O0 && make miniperl
...
./miniperl -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl. Please run make minitest; exit 1'
Segmentation fault
Failed to build miniperl. Please run make minitest
makefile​:382​: recipe for target 'lib/buildcustomize.pl' failed
make​: *** [lib/buildcustomize.pl] Error 1
tony@​mars​:.../git/perl$ gdb --args ./miniperl -e0
...
Program received signal SIGSEGV, Segmentation fault.
0x00000000006325b5 in Perl_init_constants (my_perl=0xac5010) at sv.c​:15408
15408 SvNV_set(&PL_sv_no, 0);
(gdb) bt
#0 0x00000000006325b5 in Perl_init_constants (my_perl=0xac5010) at sv.c​:15408
#1 0x000000000044718f in perl_construct (my_perl=0xac5010) at perl.c​:238
#2 0x0000000000775355 in main (argc=2, argv=0x7fffffffe898,
  env=0x7fffffffe8b0) at miniperlmain.c​:116
(gdb) disassemble $pc,$pc+16
Dump of assembler code from 0x6325b5 to 0x6325c5​:
=> 0x00000000006325b5 <Perl_init_constants+1192>​: movaps %xmm0,0x30(%rax)
  0x00000000006325b9 <Perl_init_constants+1196>​: mov -0x8(%rbp),%rax
  0x00000000006325bd <Perl_init_constants+1200>​: mov 0x16c(%rax),%eax
  0x00000000006325c3 <Perl_init_constants+1206>​: and $0xf,%eax
End of assembler dump.
(gdb) info register rax
rax 0xac6de8 11300328

movaps requires 16-byte aligned pointers​:

tony@​mars​:.../git/perl$ grep alignbytes config.sh
alignbytes='8'

Oops.

The alignbytes check in Configure doesn't appear to take usequadmath into account.

Tony

@p5pRT
Copy link
Author

p5pRT commented Apr 14, 2016

From @tonycoz

On Wed Apr 13 21​:02​:19 2016, tonyc wrote​:

The alignbytes check in Configure doesn't appear to take usequadmath
into account.

Patch.

Tony

@p5pRT
Copy link
Author

p5pRT commented Apr 14, 2016

From @tonycoz

0001-perl-127894-take-usequadmath-into-account-for-alignb.patch
From 001d4714f4564d74f3af9ce05470c698f534d0a8 Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Thu, 14 Apr 2016 14:30:50 +1000
Subject: [PATCH] (perl #127894) take usequadmath into account for alignbytes

---
 Configure | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Configure b/Configure
index ff864b0..94fb17e 100755
--- a/Configure
+++ b/Configure
@@ -20168,6 +20168,10 @@ case "$alignbytes" in
 	    $cat >try.c <<'EOCP'
 typedef long double NV;
 EOCP
+	elif $test "X$usequadmath" = Xdefine -a "X$i_quadmath" = Xdefine; then
+	    $cat >try.c <<'EOCP'
+typedef __float128 NV;
+EOCP
 	else
 	    $cat >try.c <<'EOCP'
 typedef double NV;
-- 
2.1.4

@p5pRT
Copy link
Author

p5pRT commented Apr 14, 2016

From @Tux

On Wed, 13 Apr 2016 21​:33​:10 -0700, "Tony Cook via RT"
<perlbug-followup@​perl.org> wrote​:

On Wed Apr 13 21​:02​:19 2016, tonyc wrote​:

The alignbytes check in Configure doesn't appear to take usequadmath
into account.

Patch.

So close before 5.24?

Is Rugby (#QAH) soon enough?

Tony

--
H.Merijn Brand http​://tux.nl Perl Monger http​://amsterdam.pm.org/
using perl5.00307 .. 5.23 porting perl5 on HP-UX, AIX, and openSUSE
http​://mirrors.develooper.com/hpux/ http​://www.test-smoke.org/
http​://qa.perl.org http​://www.goldmark.org/jeff/stupid-disclaimers/

@p5pRT
Copy link
Author

p5pRT commented Apr 14, 2016

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

@p5pRT
Copy link
Author

p5pRT commented Apr 14, 2016

From @ilmari

"Tony Cook via RT" <perlbug-followup@​perl.org> writes​:

On Wed Apr 13 21​:02​:19 2016, tonyc wrote​:

The alignbytes check in Configure doesn't appear to take usequadmath
into account.
[...]
diff --git a/Configure b/Configure
index ff864b0..94fb17e 100755
--- a/Configure
+++ b/Configure
@​@​ -20168,6 +20168,10 @​@​ case "$alignbytes" in
$cat >try.c <<'EOCP'
typedef long double NV;
EOCP
+ elif $test "X$usequadmath" = Xdefine -a "X$i_quadmath" = Xdefine; then
+ $cat >try.c <<'EOCP'
+typedef __float128 NV;
+EOCP
else
$cat >try.c <<'EOCP'
typedef double NV;

Instead of having to modify this every time a new NV type comes along,
why not make the check use $nvtype instead?

Inline Patch
diff --git a/Configure b/Configure
index ff864b0..2f4ffcc 100755
--- a/Configure
+++ b/Configure
@@ -20164,20 +20164,11 @@ eval $inlibc
 echo " "
 case "$alignbytes" in
     '') echo "Checking alignment constraints..." >&4
-    if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
-        $cat >try.c <<'EOCP'
-typedef long double NV;
-EOCP
-       else
-           $cat >try.c <<'EOCP'
-typedef double NV;
-EOCP
-       fi
-       $cat >>try.c <<'EOCP'
+       $cat >try.c <<EOCP
 #include <stdio.h>
 struct foobar {
     char foo;
-    NV bar;
+    $nvtype bar;
 } try_algn;
 int main()
 {


-- 

"I use RMS as a guide in the same way that a boat captain would use
a lighthouse. It's good to know where it is, but you generally
don't want to find yourself in the same spot." - Tollef Fog Heen

@p5pRT
Copy link
Author

p5pRT commented Apr 20, 2016

From @tonycoz

On Thu Apr 14 12​:33​:04 2016, ilmari wrote​:

Instead of having to modify this every time a new NV type comes along,
why not make the check use $nvtype instead?

diff --git a/Configure b/Configure
index ff864b0..2f4ffcc 100755
--- a/Configure
+++ b/Configure
@​@​ -20164,20 +20164,11 @​@​ eval $inlibc
echo " "
case "$alignbytes" in
'') echo "Checking alignment constraints..." >&4
- if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
- $cat >try.c <<'EOCP'
-typedef long double NV;
-EOCP
- else
- $cat >try.c <<'EOCP'
-typedef double NV;
-EOCP
- fi
- $cat >>try.c <<'EOCP'
+ $cat >try.c <<EOCP
#include <stdio.h>
struct foobar {
char foo;
- NV bar;
+ $nvtype bar;
} try_algn;
int main()
{

Good point, applied as ab462c7.

Tony

@p5pRT
Copy link
Author

p5pRT commented Apr 20, 2016

@tonycoz - Status changed from 'open' to 'pending release'

@p5pRT
Copy link
Author

p5pRT commented May 13, 2016

From @khwilliamson

Thank you for submitting this report. You have helped make Perl better.
 
With the release of Perl 5.24.0 on May 9, 2016, this and 149 other issues have been resolved.

Perl 5.24.0 may be downloaded via https://metacpan.org/release/RJBS/perl-5.24.0

@p5pRT
Copy link
Author

p5pRT commented May 13, 2016

@khwilliamson - Status changed from 'pending release' to 'resolved'

@p5pRT p5pRT closed this as completed May 13, 2016
@p5pRT
Copy link
Author

p5pRT commented Jul 2, 2016

From @dcollinsn

This bug exists in 5.22.2, so this fix should probably be backported to 5.22.3 if we're still supporting that?

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