Arduino icon indicating copy to clipboard operation
Arduino copied to clipboard

lto1: internal compiler error: in output_constructor_regular_field, at varasm.c:5056

Open pdmartinson opened this issue 5 years ago • 3 comments

I get the following error when compiling my sketch:

lto1: internal compiler error: in output_constructor_regular_field, at varasm.c:5056
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
lto-wrapper: fatal error: /home/peter/Documents/Boat/CruiseControl/Code/arduino-1.8.10-linux64/arduino-1.8.10/hardware/tools/avr/bin/avr-gcc returned 1 exit status
compilation terminated.
/home/peter/Documents/Boat/CruiseControl/Code/arduino-1.8.10-linux64/arduino-1.8.10/hardware/tools/avr/bin/../lib/gcc/avr/7.3.0/../../../../avr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino/Genuino Uno.

Additional context

I'm using Arduino IDE 1.8.10

Additional reports

  • https://forum.arduino.cc/t/compile-error-for-mega-or-mega-2560/967212
  • https://forum.arduino.cc/t/unable-to-verify-compile-attiny85/972643
  • https://forum.arduino.cc/t/c-arduino-compiler-crash-on-basic-struct-string-function-mix/1241280
  • https://forum.arduino.cc/t/array-of-struct-containing-objects-hd4478-h-lcds-and-list-initialization/1313494

Related

  • https://github.com/arduino/ArduinoCore-avr/issues/39
  • https://forum.arduino.cc/t/arduinoide-1-8-12-win7-32-fails-all-compiles/639874
  • https://forum.arduino.cc/t/help-erreur-de-compilatioin/975683
  • https://forum.arduino.cc/t/c-function-with-pointers/984988/11
  • https://forum.arduino.cc/t/setting-pwm-frequency-error-compiling-for-board-arduino-micro/1073375
  • https://forum.arduino.cc/t/problems-with-dht-and-serial-monitor/1109351
  • https://forum.arduino.cc/t/lto-wrapper-failed-another-one/1327715

pdmartinson avatar Feb 03 '20 01:02 pdmartinson

The version of Arduino is 1.8.10.

pdmartinson avatar Feb 03 '20 01:02 pdmartinson

Hi @pdmartinson , can you post a simple sketch that we can use to reproduce the issue? Eg. try removing some functions (even if the sketch doesn't do anything useful afterwards but still fails to compile) and attach it here, thanks.

facchinm avatar Feb 17 '20 19:02 facchinm

Hello, I encountered the same error and have a simple reproduction:

this code gives a different error:


struct A {
	int y[];
	int z[];
};

A a1 = {
	.y = { 1, 2, 3 },
	.z = { 4, 5, 6 }
};

void setup() {

}

void loop() {
	// force usage
	Serial.println(a1.y[0]);
	Serial.println(a1.z[0]);
}
Picked up JAVA_TOOL_OPTIONS:
Loading configuration...
Initializing packages...
Preparing boards...
Verifying...
boom:3:8: error: flexible array member 'A::y' in an otherwise empty 'struct A'
  int y[];
        ^
exit status 1

[Process exited 1]

(see also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71939)

and with the following diff:

--- boom.ino
+++ boom.ino
@@ -1,10 +1,12 @@

 struct A {
+       int x;
        int y[];
        int z[];
 };

 A a1 = {
+       .x = 1,
        .y = { 1, 2, 3 },
        .z = { 4, 5, 6 }
 };
@@ -15,6 +17,7 @@

 void loop() {
        // force usage
+       Serial.println(a1.x);
        Serial.println(a1.y[0]);
        Serial.println(a1.z[0]);
 }

this code breaks:

struct A {
	int x;
	int y[];
	int z[];
};

A a1 = {
	.x = 1,
	.y = { 1, 2, 3 },
	.z = { 4, 5, 6 }
};

void setup() {

}

void loop() {
	// force usage
	Serial.println(a1.x);
	Serial.println(a1.y[0]);
	Serial.println(a1.z[0]);
}

with error

Picked up JAVA_TOOL_OPTIONS:
Loading configuration...
Initializing packages...
Preparing boards...
Verifying...
lto1: internal compiler error: in output_constructor_regular_field, at varasm.c:5056
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
lto-wrapper: fatal error: /home/kipras/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc returned 1 exit status
compilation terminated.
/home/kipras/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/../lib/gcc/avr/7.3.0/../../../../avr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
exit status 1

[Process exited 1]

I'm running arch linux

$ uname -a
Linux arch-usb2 5.4.85-1-lts #1 SMP Mon, 21 Dec 2020 19:28:35 +0000 x86_64 GNU/Linux

kiprasmel avatar Dec 27 '20 08:12 kiprasmel