Skip to content

LLVM ERROR Attribute 'align' exceed the max size 2^14 #121444

Closed
@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

// #45662

#[repr(align(536870912))]
pub struct A(i64);

pub extern "C" fn foo(x: A) {}

fn main() {
    foo(A(0));
}

original:

//@ run-pass

#![allow(stable_features)]
#![allow(unused_variables)]

// #45662

#![feature(repr_align)]

#[repr(align(536870912))]
pub struct A(#[allow(dead_code)] i64);

#[allow(improper_ctypes_definitions)]
pub extern "C" fn foo(x: A) {}

fn main() {
    foo(A(0));
}

Version information

rustc 1.78.0-nightly (f8131a48a 2024-02-21)
binary: rustc
commit-hash: f8131a48a46ac3bc8a3d0fe0477055b132cffdc3
commit-date: 2024-02-21
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 18.1.0

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zincremental-verify-ich=yes -Cincremental=<dir> -Cdebuginfo=2

Program output

warning: unused variable: `x`
 --> /tmp/icemaker_global_tempdir.YLDguKS9zOCA/rustc_testrunner_tmpdir_reporting.HqYrVsxsA6S8/mvce.rs:6:23
  |
6 | pub extern "C" fn foo(x: A) {}
  |                       ^ help: if this is intentional, prefix it with an underscore: `_x`
  |
  = note: `#[warn(unused_variables)]` on by default

warning: field `0` is never read
 --> /tmp/icemaker_global_tempdir.YLDguKS9zOCA/rustc_testrunner_tmpdir_reporting.HqYrVsxsA6S8/mvce.rs:4:14
  |
4 | pub struct A(i64);
  |            - ^^^
  |            |
  |            field in this struct
  |
  = note: `#[warn(dead_code)]` on by default
help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field
  |
4 | pub struct A(());
  |              ~~

warning: `extern` fn uses type `A`, which is not FFI-safe
 --> /tmp/icemaker_global_tempdir.YLDguKS9zOCA/rustc_testrunner_tmpdir_reporting.HqYrVsxsA6S8/mvce.rs:6:26
  |
6 | pub extern "C" fn foo(x: A) {}
  |                          ^ not FFI-safe
  |
  = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
  = note: this struct has unspecified layout
note: the type is defined here
 --> /tmp/icemaker_global_tempdir.YLDguKS9zOCA/rustc_testrunner_tmpdir_reporting.HqYrVsxsA6S8/mvce.rs:4:1
  |
4 | pub struct A(i64);
  | ^^^^^^^^^^^^
  = note: `#[warn(improper_ctypes_definitions)]` on by default

Attribute 'align' exceed the max size 2^14
ptr @_ZN4mvce3foo17h02ccc75a6bd1c329E
in function _ZN4mvce3foo17h02ccc75a6bd1c329E
LLVM ERROR: Broken function found, compilation aborted!

Metadata

Metadata

Assignees

Labels

A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.llvm-fixed-upstreamIssue expected to be fixed by the next major LLVM upgrade, or backported fixesregression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions