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

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

Open
pdmartinson opened this issue Feb 3, 2020 · 3 comments
Labels
Architecture: AVR Applies only to the AVR microcontrollers (Uno, etc.) Component: Compilation Related to compilation of Arduino sketches Type: Bug

Comments

@pdmartinson
Copy link

pdmartinson commented Feb 3, 2020

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

Related

@pdmartinson

This comment has been minimized.

@per1234 per1234 added Architecture: AVR Applies only to the AVR microcontrollers (Uno, etc.) Component: Compilation Related to compilation of Arduino sketches Type: Bug labels Feb 3, 2020
@facchinm
Copy link
Member

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.

@kiprasmel
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Architecture: AVR Applies only to the AVR microcontrollers (Uno, etc.) Component: Compilation Related to compilation of Arduino sketches Type: Bug
Projects
None yet
Development

No branches or pull requests

4 participants