parallaxinc / OpenSpin

Spin/PASM compiler for the Parallax Propeller.
56 stars 19 forks source link

Version 1.00.72 segfaults when building Pikemanz #19

Closed bweir closed 9 years ago

bweir commented 9 years ago

I built from fresh copies of the mainline to be sure.

A distribution of Pikemanz can be found here: http://lamestation.net/downloads/misc/spin/Pikemanz.zip

The error in action:

$ ./build/openspin ../../00_Pikemanz.spin -L ../../../..
Propeller Spin/PASM Compiler 'OpenSpin' (c)2012-2015 Parallax Inc. DBA Parallax Semiconductor.
Version 1.00.72 Compiled on Apr 10 2015 04:10:27
Compiling...
../../00_Pikemanz.spin
|-LameLCD.spin
  |-Pinout.spin
|-LameGFX.spin
|-LameAudio.spin
  |-Pinout.spin
|-LameMusic.spin
  |-LameAudio.spin
    |-Pinout.spin
|-LameControl.spin
  |-Pinout.spin
  |-LameFunctions.spin
|-PikeState.spin
|-01_Title.spin
  |-LameLCD.spin
    |-Pinout.spin
  |-LameGFX.spin
  |-LameControl.spin
    |-Pinout.spin
    |-LameFunctions.spin
  |-PikeState.spin
  |-PikeMenu.spin
    |-LameGFX.spin
    |-LameLCD.spin
      |-Pinout.spin
    |-LameControl.spin
      |-Pinout.spin
      |-LameFunctions.spin
    |-LameFunctions.spin
    |-gfx_dialog.spin
    |-gfx_bar.spin
    |-gfx_healthbar.spin
    |-gfx_health.spin
    |-gfx_font6x6_b.spin
  |-gfx_title.spin
  |-gfx_font6x6_b.spin
  |-gfx_nash_fetchum.spin
|-02_Intro.spin
  |-LameLCD.spin
    |-Pinout.spin
  |-LameGFX.spin
  |-LameMap.spin
    |-LameGFX.spin
  |-LameControl.spin
    |-Pinout.spin
    |-LameFunctions.spin
  |-LameFunctions.spin
  |-PikeState.spin
  |-PikeMenu.spin
    |-LameGFX.spin
    |-LameLCD.spin
      |-Pinout.spin
    |-LameControl.spin
      |-Pinout.spin
      |-LameFunctions.spin
    |-LameFunctions.spin
    |-gfx_dialog.spin
    |-gfx_bar.spin
    |-gfx_healthbar.spin
    |-gfx_health.spin
    |-gfx_font6x6_b.spin
  |-gfx_nash_fetchum.spin
  |-gfx_arrow_d.spin
|-03_World.spin
  |-LameLCD.spin
    |-Pinout.spin
  |-LameGFX.spin
  |-LameMap.spin
    |-LameGFX.spin
  |-LameControl.spin
    |-Pinout.spin
    |-LameFunctions.spin
  |-LameFunctions.spin
  |-PikeState.spin
  |-gfx_nash.spin
  |-map_parrot_town.spin
  |-map_path1.spin
  |-map_path2.spin
  |-gfx_pikeman.spin
|-04_Battle.spin
  |-LameLCD.spin
    |-Pinout.spin
  |-LameGFX.spin
  |-LameAudio.spin
    |-Pinout.spin
  |-LameMusic.spin
    |-LameAudio.spin
      |-Pinout.spin
  |-LameControl.spin
    |-Pinout.spin
    |-LameFunctions.spin
  |-LameFunctions.spin
  |-PikeState.spin
  |-PikeMenu.spin
    |-LameGFX.spin
    |-LameLCD.spin
      |-Pinout.spin
    |-LameControl.spin
      |-Pinout.spin
      |-LameFunctions.spin
    |-LameFunctions.spin
    |-gfx_dialog.spin
    |-gfx_bar.spin
    |-gfx_healthbar.spin
    |-gfx_health.spin
    |-gfx_font6x6_b.spin
  |-PikeManager.spin
    |-LameGFX.spin
  |-Pikedox.spin
    |-PikeManager.spin
      |-LameGFX.spin
    |-gfx_pk_pakechu2.spin
    |-gfx_pk_adheri.spin
    |-gfx_pk_blardicuino.spin
    |-gfx_pk_ghosterman.spin
    |-gfx_pk_jarzzard.spin
    |-gfx_pk_mootoo.spin
    |-gfx_pk_pakechu.spin
    |-gfx_pk_pangueen.spin
    |-gfx_pk_phonyx.spin
    |-gfx_pk_tornadoo.spin
  |-gfx_arrow.spin
  |-gfx_dialog.spin
  |-gfx_bar.spin
  |-gfx_healthbar.spin
  |-gfx_health.spin
  |-gfx_hp.spin
  |-gfx_font6x6_b.spin
  |-gfx_black.spin
Segmentation fault (core dumped)

1.00.71 builds it just fine.

$ ./OpenSpin-1.00.71/openspin -L ../.. 00_Pikemanz.spin 
Propeller Spin/PASM Compiler 'OpenSpin' (c)2012-2014 Parallax Inc. DBA Parallax Semiconductor.
Version 1.00.71 Compiled on Apr 10 2015 03:57:42
Compiling...
00_Pikemanz.spin
|-LameLCD.spin
  |-Pinout.spin
|-LameGFX.spin
|-LameAudio.spin
  |-Pinout.spin
|-LameMusic.spin
  |-LameAudio.spin
    |-Pinout.spin
|-LameControl.spin
  |-Pinout.spin
  |-LameFunctions.spin
|-PikeState.spin
|-01_Title.spin
  |-LameLCD.spin
    |-Pinout.spin
  |-LameGFX.spin
  |-LameControl.spin
    |-Pinout.spin
    |-LameFunctions.spin
  |-PikeState.spin
  |-PikeMenu.spin
    |-LameGFX.spin
    |-LameLCD.spin
      |-Pinout.spin
    |-LameControl.spin
      |-Pinout.spin
      |-LameFunctions.spin
    |-LameFunctions.spin
    |-gfx_dialog.spin
    |-gfx_bar.spin
    |-gfx_healthbar.spin
    |-gfx_health.spin
    |-gfx_font6x6_b.spin
  |-gfx_title.spin
  |-gfx_font6x6_b.spin
  |-gfx_nash_fetchum.spin
|-02_Intro.spin
  |-LameLCD.spin
    |-Pinout.spin
  |-LameGFX.spin
  |-LameMap.spin
    |-LameGFX.spin
  |-LameControl.spin
    |-Pinout.spin
    |-LameFunctions.spin
  |-LameFunctions.spin
  |-PikeState.spin
  |-PikeMenu.spin
    |-LameGFX.spin
    |-LameLCD.spin
      |-Pinout.spin
    |-LameControl.spin
      |-Pinout.spin
      |-LameFunctions.spin
    |-LameFunctions.spin
    |-gfx_dialog.spin
    |-gfx_bar.spin
    |-gfx_healthbar.spin
    |-gfx_health.spin
    |-gfx_font6x6_b.spin
  |-gfx_nash_fetchum.spin
  |-gfx_arrow_d.spin
|-03_World.spin
  |-LameLCD.spin
    |-Pinout.spin
  |-LameGFX.spin
  |-LameMap.spin
    |-LameGFX.spin
  |-LameControl.spin
    |-Pinout.spin
    |-LameFunctions.spin
  |-LameFunctions.spin
  |-PikeState.spin
  |-gfx_nash.spin
  |-map_parrot_town.spin
  |-map_path1.spin
  |-map_path2.spin
  |-gfx_pikeman.spin
|-04_Battle.spin
  |-LameLCD.spin
    |-Pinout.spin
  |-LameGFX.spin
  |-LameAudio.spin
    |-Pinout.spin
  |-LameMusic.spin
    |-LameAudio.spin
      |-Pinout.spin
  |-LameControl.spin
    |-Pinout.spin
    |-LameFunctions.spin
  |-LameFunctions.spin
  |-PikeState.spin
  |-PikeMenu.spin
    |-LameGFX.spin
    |-LameLCD.spin
      |-Pinout.spin
    |-LameControl.spin
      |-Pinout.spin
      |-LameFunctions.spin
    |-LameFunctions.spin
    |-gfx_dialog.spin
    |-gfx_bar.spin
    |-gfx_healthbar.spin
    |-gfx_health.spin
    |-gfx_font6x6_b.spin
  |-PikeManager.spin
    |-LameGFX.spin
  |-Pikedox.spin
    |-PikeManager.spin
      |-LameGFX.spin
    |-gfx_pk_pakechu2.spin
    |-gfx_pk_adheri.spin
    |-gfx_pk_blardicuino.spin
    |-gfx_pk_ghosterman.spin
    |-gfx_pk_jarzzard.spin
    |-gfx_pk_mootoo.spin
    |-gfx_pk_pakechu.spin
    |-gfx_pk_pangueen.spin
    |-gfx_pk_phonyx.spin
    |-gfx_pk_tornadoo.spin
  |-gfx_arrow.spin
  |-gfx_dialog.spin
  |-gfx_bar.spin
  |-gfx_healthbar.spin
  |-gfx_health.spin
  |-gfx_hp.spin
  |-gfx_font6x6_b.spin
  |-gfx_black.spin
Done.
Program size is 18364 bytes

BSTC builds it fine.

$ bstc.linux -L ../.. 00_Pikemanz.spin 
Found a USB Serial Device
Brads Spin Tool Compiler v0.15.3 - Copyright 2008,2009 All rights reserved
Compiled for i386 Linux at 08:17:46 on 2009/07/20
Loading Object 00_Pikemanz
Loading Object LameLCD
Loading Object Pinout
Loading Object LameGFX
Loading Object LameAudio
Loading Object LameMusic
Loading Object LameControl
Loading Object LameFunctions
Loading Object PikeState
Loading Object 01_Title
Loading Object PikeMenu
Loading Object gfx_dialog
Loading Object gfx_bar
Loading Object gfx_healthbar
Loading Object gfx_health
Loading Object gfx_font6x6_b
Loading Object gfx_title
Loading Object gfx_nash_fetchum
Loading Object 02_Intro
Loading Object LameMap
Loading Object gfx_arrow_d
Loading Object 03_World
Loading Object gfx_nash
Loading Object map_parrot_town
Loading Object map_path1
Loading Object map_path2
Loading Object gfx_pikeman
Loading Object 04_Battle
Loading Object PikeManager
Loading Object Pikedox
Loading Object gfx_pk_pakechu2
Loading Object gfx_pk_adheri
Loading Object gfx_pk_blardicuino
Loading Object gfx_pk_ghosterman
Loading Object gfx_pk_jarzzard
Loading Object gfx_pk_mootoo
Loading Object gfx_pk_pakechu
Loading Object gfx_pk_pangueen
Loading Object gfx_pk_phonyx
Loading Object gfx_pk_tornadoo
Loading Object gfx_arrow
Loading Object gfx_hp
Loading Object gfx_black
Program size is 18360 longs
Compiled 3715 Lines of Code in 0.16 Seconds

Here's a backtrace. The error is happening somewhere in your new code.

(gdb) trace
Tracepoint 1 at 0x7ffff6935c8d: file ../sysdeps/x86_64/multiarch/strstr-sse2-unaligned.S, line 40.
(gdb) backtrace
#0  __strstr_sse2_unaligned () at ../sysdeps/x86_64/multiarch/strstr-sse2-unaligned.S:40
#1  0x00000000004184fd in AddObjectName (pFilename=0x7fffffffa1a0 "gfx_black.spin", indent=3) at ../PropellerCompiler/UnusedMethodUtils.cpp:38
#2  0x0000000000402ff4 in CompileRecursively (pFilename=0x7fffffffa1a0 "gfx_black.spin", bQuiet=false, bFileTreeOutputOnly=false) at openspin.cpp:261
#3  0x00000000004031b5 in CompileRecursively (pFilename=0x7fffffffba20 "04_Battle.spin", bQuiet=false, bFileTreeOutputOnly=false) at openspin.cpp:296
#4  0x00000000004031b5 in CompileRecursively (pFilename=0xe7b978 "/home/brett/Projects/lamestation-sdk/games/Pikemanz/00_Pikemanz.spin", bQuiet=false, bFileTreeOutputOnly=false)
    at openspin.cpp:296
#5  0x0000000000406134 in main (argc=4, argv=0x7fffffffdf38) at openspin.cpp:746

It's always failing on that one file, but unfortunately there's nothing particularly exciting about this file.

open("gfx_black.spin", O_RDONLY)        = -1 ENOENT (No such file or directory)
open("/home/brett/Projects/lamestation-sdk//gfx_black.spin", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/brett/Projects/lamestation-sdk/games/Pikemanz/gfx_black.spin", O_RDONLY) = 6
fstat(6, {st_mode=S_IFREG|0664, st_size=607, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc6af76a000
fstat(6, {st_mode=S_IFREG|0664, st_size=607, ...}) = 0
lseek(6, 0, SEEK_SET)                   = 0
read(6, "' ******************************"..., 607) = 607
lseek(6, 607, SEEK_SET)                 = 607
close(6)                                = 0
munmap(0x7fc6af76a000, 4096)            = 0
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x60f72c8abc} ---
+++ killed by SIGSEGV (core dumped) +++
Segmentation fault (core dumped)
PropGit commented 9 years ago

Thanks for all the great information, @bweir. As soon as I saw this I figured it had to do with the recent major changes.

bweir commented 9 years ago

Hey, no problem. :)

I also just realized something. gfx_black.spin is simply the last file that's compiled.

PropGit commented 9 years ago

@reltham have you looked into this problem yet?

reltham commented 9 years ago

This was because that project has more than 128 files in it, and one of my internal arrays only handled 128. I've fixed this locally, and also added some extra checks so it won't store any of the extra data needed for unused method elimination if it's not enabled. I'll submit the fixes later tonight after I do some more testing.

reltham commented 9 years ago

This is fixed with 1.00.73

bweir commented 9 years ago

Okay, I'll give it a try. Thanks, Roy. :) On May 7, 2015 5:30 PM, "Roy Eltham" notifications@github.com wrote:

This is fixed with 1.00.73

— Reply to this email directly or view it on GitHub https://github.com/parallaxinc/OpenSpin/issues/19#issuecomment-100054622 .