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

hashkeybag.tst gives Bus Error on SPARC Solaris 11 #2191

Closed
dimpase opened this issue Feb 17, 2018 · 5 comments
Closed

hashkeybag.tst gives Bus Error on SPARC Solaris 11 #2191

dimpase opened this issue Feb 17, 2018 · 5 comments
Labels
kind: bug Issues describing general bugs, and PRs fixing them

Comments

@dimpase
Copy link
Member

dimpase commented Feb 17, 2018

Observed behaviour

gap> HashKeyBag([1,2,3],0,1,-1) <> HashKeyWholeBag([1,2,3],0);
Bus Error (core dumped)

Expected behaviour

should work (it's a part of "hashkeybag.tst") - the other tests in this file work
(as well as all the tests preceding this one in "testinstall.g")

Copy and paste GAP banner (to tell us about your setup)

 *********   GAP 4.9.0 of 01-Feb-2018
 *  GAP  *   https://www.gap-system.org
 *********   Architecture: sparc-sun-solaris2.11-default64
 Configuration:  gmp 6.1.2, KernelDebug
 Loading the library and packages ...
 Packages:   AClib 1.2, Alnuth 3.1.0, AtlasRep 1.5.1, AutPGrp 1.8, CRISP 1.4.4, Cryst 4.1.13, CrystCat 1.1.6, CTblLib 1.2.2, FactInt 1.6.1, FGA 1.3.1,
             GAPDoc 1.6.1, IRREDSOL 1.4, LAGUNA 3.8.0, Polenta 1.3.8, Polycyclic 2.11, PrimGrp 3.3.0, RadiRoot 2.7, ResClasses 4.7.1, smallgrp 1.2,
             Sophus 1.23, SpinSym 1.5, TomLib 1.2.6, TransGrp 2.0.2, utils 0.53

built with gcc 5.4.0 (or gcc 7.2.0, with no difference in the outcome)
and also no difference in CFLAGS (with or without debugging options on)
Also, the same error with gap 4.8.6.

I suppose it's one of these big-endian bugs...

Here is the gdb output:

$ gdb --core=core gap
GNU gdb (GDB) 7.6
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "sparc-sun-solaris2.11".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /datapool/dima/Sage/gap-4.9.0/gap...done.
[New LWP 1]
[New LWP 1]
[Thread debugging using libthread_db enabled]
[New Thread 1 (LWP 1)]
Core was generated by `/datapool/dima/Sage/gap-4.9.0/gap -l /datapool/dima/Sage/gap-4.9.0'.
Program terminated with signal 10, Bus error.
#0  0x00000001001a454c in getblock8 (i=0, p=0x10000616b279) at src/intfuncs.c:313
313       return p[i];
(gdb) bt
#0  0x00000001001a454c in getblock8 (i=0, p=0x10000616b279) at src/intfuncs.c:313
#1  MurmurHash3_x64_128 (key=key@entry=0x10000616b279, len=len@entry=31, seed=seed@entry=0, out=out@entry=0xffffffff7fffbf60) at src/intfuncs.c:350
#2  0x00000001001a4890 in HASHKEY_MEM_NC (ptr=0x10000616b279, seed=seed@entry=0, read=read@entry=31) at src/intfuncs.c:480
#3  0x00000001001a48f8 in HASHKEY_BAG_NC (obj=obj@entry=0x100000611f48, seed=seed@entry=0, skip=skip@entry=1, read=<optimized out>) at src/intfuncs.c:491
#4  0x00000001001a4cb8 in FuncHASHKEY_BAG (self=<optimized out>, obj=0x100000611f48, opSeed=0x1, opOffset=0x5, opMaxLen=0xfffffffffffffffd)
    at src/intfuncs.c:473
#5  0x00000001001a9de8 in IntrFuncCallEnd (funccall=funccall@entry=1, options=0, nr=4) at src/intrprtr.c:431
#6  0x00000001002a7868 in ReadCallVarAss (follow=follow@entry=3221225472, mode=mode@entry=120 'x') at src/read.c:672
#7  0x00000001002a8314 in ReadAtom (follow=follow@entry=3221225472, mode=mode@entry=120 'x') at src/read.c:1690
#8  0x00000001002a855c in ReadFactor (follow=follow@entry=3221225472, mode=mode@entry=120 'x') at src/read.c:1752
#9  0x00000001002a8840 in ReadTerm (follow=follow@entry=3221225472, mode=mode@entry=120 'x') at src/read.c:1807
#10 0x00000001002a89c4 in ReadAri (follow=follow@entry=3221225472, mode=mode@entry=120 'x') at src/read.c:1840
#11 0x00000001002a8b58 in ReadRel (follow=follow@entry=3221225472, mode=mode@entry=120 'x') at src/read.c:1879
#12 0x00000001002a8dec in ReadAnd (follow=follow@entry=3221225472, mode=mode@entry=120 'x') at src/read.c:1918
#13 0x00000001002a8f7c in ReadExpr (follow=follow@entry=3221225472, mode=mode@entry=120 'x') at src/read.c:1990
#14 0x00000001002ae2fc in ReadEvalCommand (context=0x100000000050, evalResult=evalResult@entry=0xffffffff7fffceb8, 
    dualSemicolon=dualSemicolon@entry=0xffffffff7fffceb0) at src/read.c:2696
#15 0x000000010017bed4 in Shell (context=context@entry=0x100000000050, canReturnVoid=canReturnVoid@entry=0, canReturnObj=canReturnObj@entry=0, lastDepth=3, 
    setTime=setTime@entry=1, prompt=prompt@entry=0xffffffff7fffcf98 "gap> ", preCommandHook=<error reading variable: can't compute CFA for this frame>, 
    catchQUIT=<error reading variable: can't compute CFA for this frame>, inFile=<error reading variable: can't compute CFA for this frame>, 
    outFile=<error reading variable: can't compute CFA for this frame>) at src/gap.c:240
#16 0x0000000100181b3c in FuncSHELL (self=<optimized out>, args=0x100000611d48) at src/gap.c:437
#17 0x00000001001683ac in ExecProccallXargs (call=464) at src/funcs.c:404
#18 0x00000001002ccf30 in EXEC_STAT (stat=<optimized out>) at ./src/stats.h:53
#19 ExecSeqStat4 (stat=32) at src/stats.c:204
#20 0x0000000100166764 in EXEC_STAT (stat=32) at ./src/stats.h:53
#21 ExecFuncHelper () at src/funcs.c:842
#22 0x000000010016e788 in DoExecFunc0args (func=0x100000077d58) at src/funcs.c:865
#23 0x00000001001a9d30 in IntrFuncCallEnd (funccall=funccall@entry=0, options=0, nr=0) at src/intrprtr.c:427
#24 0x00000001002a7db4 in ReadCallVarAss (follow=follow@entry=3254779904, mode=mode@entry=115 's') at src/read.c:705
#25 0x00000001002a37e8 in ReadStats (follow=follow@entry=3254779904) at src/read.c:2577
#26 0x00000001002ac29c in ReadIf (follow=follow@entry=3221225472) at src/read.c:2147
#27 0x00000001002ae360 in ReadEvalCommand (context=0x100000000050, evalResult=evalResult@entry=0xffffffff7fffdcb8, dualSemicolon=dualSemicolon@entry=0x0)
    at src/read.c:2702
#28 0x00000001002dfb64 in READ_GAP_ROOT (filename=0x100048b40 "lib/init.g") at src/streams.c:461
#29 0x0000000100184820 in InitializeGap (pargc=pargc@entry=0xffffffff7fffeeb0, argv=argv@entry=0xffffffff7fffef98, environ=environ@entry=0xffffffff7fffefb8)
    at src/gap.c:3237
#30 0x00000001001848ac in realmain (argc=argc@entry=3, argv=argv@entry=0xffffffff7fffef98, environ=environ@entry=0xffffffff7fffefb8) at src/gap.c:453
#31 0x0000000100184994 in main (argc=<optimized out>, argv=0xffffffff7fffef98, environ=0xffffffff7fffefb8) at src/gap.c:489
@dimpase
Copy link
Member Author

dimpase commented Feb 19, 2018

The Bus Error happens upon calling HashKeyBag([1,2,3],0,1,-1), whereas HashKeyWholeBag([1,2,3],0) works.

@ChrisJefferson
Copy link
Contributor

I don't think it's big-endian, I think it's an alignment issue.

Try changing getBlock8 to (warning, untested, as I do not have a SPARC)

FORCE_INLINE uint64_t getblock8 ( const uint64_t * p, int i )
{
#if ! defined(SPARC)
  uint64_t val;
  memcpy(&val, p + i, sizeof(uint64_t));
  return val;
#else
  return p[i];
#endif
}

@dimpase dimpase added the kind: bug Issues describing general bugs, and PRs fixing them label Feb 19, 2018
@dimpase
Copy link
Member Author

dimpase commented Feb 19, 2018

Bingo! At least this fixes this particular test. More testing now.
(naturally, it should be #if defined(....)

@dimpase
Copy link
Member Author

dimpase commented Feb 19, 2018

OK, this seem to work (modulo #2193 and #2194).

However, #ifdef SPARC does not strike me as a portable way to do things. I'm looking at using autoconf's macro ax_check_aligned_access_required

dimpase added a commit to dimpase/gap that referenced this issue Feb 19, 2018
On SPARC solaris hashing is broken due to an alignement issue,
and this is a fix for it.
@dimpase
Copy link
Member Author

dimpase commented Feb 21, 2018

fixed by #2196

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Issues describing general bugs, and PRs fixing them
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants