arduino / Arduino

Arduino IDE 1.x
https://www.arduino.cc/en/software
Other
14.07k stars 7.01k forks source link

Ardino IDE 1.5.7 cpp segmentation fault #2336

Closed ziotibia81 closed 9 years ago

ziotibia81 commented 9 years ago

-Add "compiler.cpp.extra_flags=-fpermissive" to platform.local.txr -Install this DCF77 library: http://blog.blinkenlight.net/experiments/dcf77/dcf77-library/ -Compile the example "Simple Clock"

gpp has a segmentation fault. Tested in windows e linux.

matthijskooijman commented 9 years ago

Hmm, this is really a bug for upstream gcc then. Could you paste here the last few lines of Arduino's verbose compilation output (in particular the full gcc command that segfaults)? If you know how, the full preprocessed source would be good. If you don't, I'll show you the command to use after you paste the segfaulting command.

ziotibia81 commented 9 years ago

I have cpp preprocessed sources but I can't attach here. The error is:

Arduino:1.5.7 (Windows XP), Scheda:"Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"

Uso la libreria dcf77_library nella cartella: C:\Documents and Settings\STEFANOD\Documenti\Arduino\libraries\dcf77_library (legacy)

C:\Documents and Settings\STEFANOD\Desktop\TMP\clock\arduino-1.5.7/hardware/tools/avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -MMD -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=157 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -fpermissive -save-temps -IC:\Documents and Settings\STEFANOD\Desktop\TMP\clock\arduino-1.5.7\hardware\arduino\avr\cores\arduino -IC:\Documents and Settings\STEFANOD\Desktop\TMP\clock\arduino-1.5.7\hardware\arduino\avr\variants\mega -IC:\Documents and Settings\STEFANOD\Documenti\Arduino\libraries\dcf77_library C:\DOCUME~1\STEFANOD\IMPOST~1\Temp\build5418792851543519872.tmp\Simple_Clock.cpp -o C:\DOCUME~1\STEFANOD\IMPOST~1\Temp\build5418792851543519872.tmp\Simple_Clock.cpp.o

C:\Documents and Settings\STEFANOD\Desktop\TMP\clock\arduino-1.5.7/hardware/tools/avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -MMD -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=157 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -fpermissive -save-temps -IC:\Documents and Settings\STEFANOD\Desktop\TMP\clock\arduino-1.5.7\hardware\arduino\avr\cores\arduino -IC:\Documents and Settings\STEFANOD\Desktop\TMP\clock\arduino-1.5.7\hardware\arduino\avr\variants\mega -IC:\Documents and Settings\STEFANOD\Documenti\Arduino\libraries\dcf77_library -IC:\Documents and Settings\STEFANOD\Documenti\Arduino\libraries\dcf77_library\utility C:\Documents and Settings\STEFANOD\Documenti\Arduino\libraries\dcf77_library\dcf77.cpp -o C:\DOCUME~1\STEFANOD\IMPOST~1\Temp\build5418792851543519872.tmp\dcf77_library\dcf77.cpp.o

C:\Documents and Settings\STEFANOD\Documenti\Arduino\libraries\dcf77_library\dcf77.cpp: In function 'void DCF77_Encoder::_ZN13DCF77_Encoder14advance_minuteERN5DCF7711time_data_tE.part.4(DCF77::time_data_t&)': C:\Documents and Settings\STEFANOD\Documenti\Arduino\libraries\dcf77_library\dcf77.cpp:3220:1: internal compiler error: Segmentation fault } ^ Please submit a full bug report, with preprocessed source if appropriate. See http://gcc.gnu.org/bugs.html for instructions.

matthijskooijman commented 9 years ago

Perhaps you could put up the preprocessed source on pastebin?

matthijskooijman commented 9 years ago

Ah, just noticed you sent them by mail, that's fine as well.

matthijskooijman commented 9 years ago

Ok, using that I can reproduce it here. I'll forward this to the gcc maintainers, thanks.

matthijs@grubby:~$ avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -MMD -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=157 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -fpermissive -save-temps  ~/tmp/dcf77.ii -o /tmp/foo.o
C:\Documents and Settings\STEFANOD\Documenti\Arduino\libraries\dcf77_library\dcf77.cpp: In function ‘void DCF77_Encoder::_ZN13DCF77_Encoder14advance_minuteERN5DCF7711time_data_tE.part.4(DCF77::time_data_t&)’:
C:\Documents and Settings\STEFANOD\Documenti\Arduino\libraries\dcf77_library\dcf77.cpp:3220:1: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
matthijs@grubby:~$ avr-g++ --version
avr-g++ (GCC) 4.8.1
Copyright (C) 2013 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.
matthijskooijman commented 9 years ago

Further investigation shows that this problem isn't avr-gcc specific, it also occurs with regular gcc. Furthermore, I've reduced the commandline to just this:

g++-4.8 -Os -fpermissive ~/tmp/dcf77.ii -o /tmp/foo.o

which also crashes. However, using g++-4.9 does not crash, so it seems this bug was already fixed upstream (so I'll refrain from reporting it and investigate further). When Atmel and then Arduino update the gcc toolchain to a newer version, this bug should be automatically be fixed.

For reference, here's the offending preprocessed source. I've tried to minimize it, without any success (didn't try for long, though). https://gist.github.com/matthijskooijman/6f336497b4ad5741ff08

agdl commented 9 years ago

@matthijskooijman what about this issue?

agdl commented 9 years ago

@matthijskooijman up

cmaglie commented 9 years ago

This is a gcc bug, I guess we should close this issue and wait for a fix on upstream gcc.