develooper Front page | perl.perl5.porters | Postings from May 2010

Re: Compiling with clang

Thread Previous
From:
Dominic Dunlop
Date:
May 6, 2010 12:39
Subject:
Re: Compiling with clang
Message ID:
BA4FE6BC-D258-4231-A3BF-26E9384A63D4@computer.org
On 2010–05–06, at 18:10, hv@crypt.org wrote:

> I tried compiling bleadperl with clang (<http://clang.llvm.org>), which
> has nicely picky, verbose error messages.

Ah, me too, but on Mac OS X, not Linux. I even tried a couple of smokers, using -flto, because I was interested in seeing how the linker coped with code generation. They produced reports like <http://www.nntp.perl.org/group/perl.daily-build.reports/2010/04/msg80899.html>. Like you, I saw scads of "return value unused" and a few other warnings. (FWIW, I also tried -flto on Ubuntu 9.10 Linux, but ld does not accept it.)

I stopped smoking because all debugging builds fail:

O O O m - - -Dcc=clang -Dld=ld='env MACOSX_DEPLOYMENT_TARGET=10.3 clang' -Aldflags=-flto -Accflags=-flto
O O O m - - -Dcc=clang -Dld=ld='env MACOSX_DEPLOYMENT_TARGET=10.3 clang' -Aldflags=-flto -Accflags=-flto -Duse64bitint
O O O m - - -Dcc=clang -Dld=ld='env MACOSX_DEPLOYMENT_TARGET=10.3 clang' -Aldflags=-flto -Accflags=-flto -Duseithreads
O O O m - - -Dcc=clang -Dld=ld='env MACOSX_DEPLOYMENT_TARGET=10.3 clang' -Aldflags=-flto -Accflags=-flto -Duseithreads -Duse64bitint
| | | | | +- LC_ALL = en_GB.UTF-8 -DDEBUGGING
| | | | +--- PERLIO = perlio -DDEBUGGING
| | | +----- PERLIO = stdio  -DDEBUGGING
| | +------- LC_ALL = en_GB.UTF-8
| +--------- PERLIO = perlio
+----------- PERLIO = stdio 

This turns out to be because of a few lines like this in gv.c and dump.c:

	    autogv = gv_autoload4(GvSTASH(stubgv),
				  GvNAME(stubgv), GvNAMELEN(stubgv), TRUE);

which, only under -DDEBUGGING elicit this error

gv.c:685:7: error: incompatible type passing 'char [1]', expected
      'char const *'
                                  GvNAME(stubgv), GvNAMELEN(stubgv), TRUE);
                                  ^~~~~~~~~~~~~~

The char[1] in question is the hek_key member of a struct he. To cut to the chase, after wading through the enormous debugging expansions of the various macros involved and being able to see nothing untoward (which is not to say it's not there), I filed it as a bug: <http://llvm.org/bugs/show_bug.cgi?id=7008>. See that page for a fuller story.

Apart from a quick response to check that I had not overlooked anything trivial, I've heard nothing. This is not surprising, given that I did not provide a concise test case. I had been hoping to get some feedback from the clang community before airing the issue on p5p ...
-- 
Dominic Dunlop




Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About