Skip to content

[GCC only] C codegen bug - extra brace group at end of initializer #25886

Description

@mratsim

While trying to reduce #25883 I hit another C codegen bug on GCC only, but not on Clang

type
  Int[V: static int] = object
  Layout[Sh, St] = object
    shape*: Sh
    stride*: St

func makeB(): auto =
  Layout[((Int[2], Int[3]), Int[5], Int[7]), ((Int[1], Int[2]), Int[6], Int[30])](
    shape: ((Int[2](), Int[3]()), Int[5](), Int[7]()),
    stride: ((Int[1](), Int[2]()), Int[6](), Int[30]())
  )

func makeC(): auto =
  Layout[((Int[2], Int[3], Int[5]), Int[7]), ((Int[1], Int[2], Int[6]), Int[30])](
    shape: ((Int[2](), Int[3](), Int[5]()), Int[7]()),
    stride: ((Int[1](), Int[2](), Int[6]()), Int[30]())
  )


proc main() =
  let b = makeB()
  let c = makeC()

main()
static NIM_CONST tyTuple__NvkvE9cz4oNnHQHfHGhsGbw TM__9bi1cBaJefARNS9cXsV9apbNQ_4 = {{{}
,
{}
,
{}
}
@mdebug_group_v2.nim.c:107:1: error: extra brace group at end of initializer

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions