I managed to crash avr-gcc :P

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just this (as C++ code):

 

struct {} __attribute__((io (0x20)));

internal compiler error: Segmentation fault

 

I guess it's just too wrong and gcc couldn't take it.

 

I'm just posting to see if a few people can reproduce this, so I can file a bug report.

Last Edited: Fri. Aug 18, 2017 - 06:38 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Duplicated in 5.4 and 4.9.  Works OK (error messages but no crash) in 4.6 and 4.3

 

 avr-gcc -O3 -mmcu=atmega328 bar.c
cc1: warning: 'io' attribute only applies to variables
bar.c:3:8: internal compiler error: Segmentation fault: 11
 struct {} __attribute__((io (0x20)));
        ^

bar.c:3:8: internal compiler error: Abort trap: 6
avr-gcc: internal compiler error: Abort trap: 6 (program cc1)
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://www.atmel.com> for instructions.

 

 avr-gcc --version
avr-gcc (AVR_8_bit_GNU_Toolchain_3.6.0_487) 5.4.0
Copyright (C) 2015 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.

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

http://gcc.gnu.org/viewcvs/gcc/t...

 

After determining that the attribute is applied to a non-decl, analysis should just stop instead of diving into arg analysis (under wrong assertion).
 

avrfreaks does not support Opera. Profile inactive.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, I'm on an unlucky roll...

 

I was testing some C++17 features that might come in handy, when boom, another bug, this one is not specific to avr-gcc. It's only present in gcc 7.1.0, and naturally this is the version I was using for the testsangry

It's because of the "auto" type in the template arguments, "int", for example, is OK. This is a C++17 feature that was precisely added on this version, so it's normal to have a bug.

Minimal code:

 

template <int i>
struct S1 {
		template <int j, auto ... a>
		struct S2 {};

		template <int j>
		struct S2<j> {};

		S2<0> test;
};


int main() {
	S1<1> test;
}

 

Fortunately, it is already corrected, so now, to find a build of avr-gcc 7.2.0. Btw, this is a nice site for testing: https://wandbox.org/#wandbox-std...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrfreaks does not support Opera. Profile inactive.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you, that was very efficient yes