[cfe-commits] r126116 - /cfe/trunk/lib/Sema/SemaInit.cpp

Abramo Bagnara abramo.bagnara at gmail.com
Mon Feb 21 00:45:35 PST 2011


Il 21/02/2011 08:57, John McCall ha scritto:
> Author: rjmccall
> Date: Mon Feb 21 01:57:55 2011
> New Revision: 126116
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=126116&view=rev
> Log:
> Reorganize subelement initialization checking, no functionality change.
> 

While you're on this area I'd like to submit you a long standing problem
in current implementation of subelement initialization expansion.

We think that the idea to expand the array range initialization is a
very bad one for at least a few reason:

1) it needs an unlimited amount of AST nodes (and in real cases a lot of
time/memory)

2) it change the semantic when an array range is initialized with an
expression with side effects.

I believe this is one of the reason why now clang is forced to refuse to
generate code for:

int f();

int g() {
  int a[] = { [0 ... 10] = f() };
}

Our proposal would be to keep syntatical array range initialization and
implicitly generated ones (due to holes in initialization sequences) in
the form of array range initializer also in semantic initializer list.



More information about the cfe-commits mailing list