[cfe-dev] POD struct

Matt Fowles matt.fowles at gmail.com
Tue Apr 10 19:44:09 PDT 2012


Eli~

I am interested in clang development and this seemed like an easy enough
bug to start with so I thought I would try it out.  I have managed to get
llvm checked out and building without problems.  I found the tests and have
turned the above example into a test in a new file
`test/SemaCXX/inner-pod-struct.cpp`.

Unfortunately, I cannot figure out how to use lit.py properly.  I have
looked at

http://clang.llvm.org/hacking.html#testingNonWindows

but am a bit confused as it refers to non-existant files in several places.
 In particular,


python (path to llvm)\llvm\utils\lit\lit.py -sv
  --param=build_mode=Win32 --param=build_config=Debug
  --param=clang_site_config=(build dir)\tools\clang\test\lit.site.cfg
  (path to llvm)\llvm\tools\clang\test\(dir)\(test)


is giving me trouble.  On my machine, ~/dev/llvm is the llvm checkout and
~/dev/llvm-build is the build dir.

boots at eiji:~/dev/llvm-build$ find . -name lit.site.cfg
boots at eiji:~/dev/llvm-build$


Kind of a bust there, what about the llvm dir?


boots at eiji:~/dev/llvm$ find . -name lit.site.cfg
./utils/lit/lit/ExampleTests/LLVM.InTree/test/lit.site.cfg
./utils/lit/lit/ExampleTests/LLVM.OutOfTree/obj/test/lit.site.cfg
./utils/lit/lit/ExampleTests.ObjDir/lit.site.cfg


Something at least.


boots at eiji:~/dev/llvm-build$ python ~/dev/llvm/utils/lit/lit.py
--param=clang_site_config=../llvm/./utils/lit/lit/ExampleTests/LLVM.OutOfTree/obj/test/lit.site.cfg
/Users/boots/dev/llvm/tools/clang/test/
-- Testing: 1 tests, 4 threads --
PASS: LLVM :: Foo/pct-S.ll (1 of 1)
Testing Time: 0.28s
  Expected Passes    : 1


But wait, that ran entirely the wrong tests?


boots at eiji:~/dev/llvm$ find . -name pct-S.ll
./utils/lit/lit/ExampleTests/LLVM.OutOfTree/src/test/Foo/pct-S.ll


... Time passes while I hack and compose this email ...

I discover that:


boots at eiji:~/dev/llvm-build$ cd tools/clang/
boots at eiji:~/dev/llvm-build/tools/clang$ make test
Making Clang 'lit.site.cfg' file...
Making Clang 'Unit/lit.site.cfg' file...
oots at eiji:~/dev/llvm-build/tools/clang/test$ python
~/dev/llvm/utils/lit/lit.py --param=clang_site_config=lit.site.cfg
~/dev/llvm/tools/clang/test/SemaCXX/inner-pod-struct.cpp
lit.py: lit.cfg:175: note: using clang:
'/Users/boots/dev/llvm-build/Release+Asserts/bin/clang'
-- Testing: 1 tests, 4 threads --
FAIL: Clang :: SemaCXX/inner-pod-struct.cpp (1 of 1)
Testing Time: 0.28s
********************
Failing Tests (1):
    Clang :: SemaCXX/inner-pod-struct.cpp

  Unexpected Failures: 1


Is the incantation I need.

Can we expand the testing page slightly to include mention that you have to
run `make test` in the build/tools/clang directory to generate the cfg
files?

Thanks,
Matt



On Tue, Apr 10, 2012 at 9:04 PM, Eli Friedman <eli.friedman at gmail.com>wrote:

> On Tue, Apr 10, 2012 at 5:37 PM, Guillaume Marcais
> <guillaume.marcais at marcais.net> wrote:
> > The following simple program creates a variable length array of
> structures:
> >
> > //template<typename T>
> > class Test {
> > public:
> >  struct toto {
> >    int* x;
> >  };
> >
> >  void method(int nb) {
> >    toto ary[nb];
> >    for(int i = 0; i < nb; ++i)
> >      ary[i].x = 0;
> >  }
> > };
> >
> >
> > int main(int argc, char* argv[]) {
> >  //Test<char> t;
> >  Test t;
> >  t.method(5);
> >
> >  return 0;
> > }
> >
> > In compiles properly as written with clang++ (version 3.0). When
> > uncommeting the templated version, then the compiler complains:
> >
> > POD.cc:9:13: error: variable length array of non-POD element type
> > 'Test<char>::toto'
> >    toto ary[nb];
> >
> > It does not seem right. 'struct toto' still looks like a POD. Why
> > isn't it one anymore?
> >
> > As a side note, g++ compiles this code without complaining.
>
> Looks like a bug; please file at llvm.org/bugs/ .
>
> -Eli
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120410/dee6ecaf/attachment.html>


More information about the cfe-dev mailing list