# New Ticket Created by James E Keenan
# Please include the string: [perl #134375]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/Ticket/Display.html?id=134375 >
[The following is probably relevant to
https://rt.perl.org/Ticket/Display.html?id=134371, but I'm filing it
separately as it may be a more general problem.]
When I select '-Dcc=clang++', as distinct from '-Dcc=clang', ./Configure
produces different results. This difference appears to be independent
of both operating system and other configuration options.
Suppose first that I configure blead
(7654aaa1134e4908a6a6dc0b85d360816e79faa3, Aug 17 2019) on Linux as follows:
#####
sh ./Configure -de -Dusedevel -Dcc=clang
#####
... and then record the output of ./Configure in a file.
Next, suppose I clean the checkout then reconfigure and re-record the
output as follows:
#####
sh ./Configure -de -Dusedevel -Dcc=clang++
#####
Here are the compiler versions:
#####
$ clang --version; clang++ --version
clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
#####
If I diff the two output files, I get several differences, but the
following appears to be most significant:
#####
766c779,786
< I'll use gcvt to convert floats into a string.
---
> gcvt oddity: Expected 0.1, got 0.1
> ...But gcvt didn't work as I expected.
> Trying sprintf...
> sprintf() found.
> sprintf oddity: Expected 0.1, got 0.1
> ...But sprintf didn't work as I expected.
> *** WHOA THERE!!! ***
> None of ( gconvert gcvt sprintf) seemed to work properly. I'll use
sprintf.
#####
./Configure composes and runs a number of C programs on the fly as
probes. This file is typically named 'try.c'; the content of 'try.c' is
redefined several times during ./Configure. The relevant try.c starts
shortly after this comment at line 10370: ": Check how to convert floats
to strings." Within this C program we define a function called 'checkit()'.
#####
10429 int checkit(char *expect, char *got)
10430 {
10431 if (strcmp(expect, got)) {
10432 printf("%s oddity: Expected %s, got %s\n",
10433 myname, expect, got);
10434 exit(1);
10435 }
10436 }
#####
Line 10432 above is the source of the surprising output above that I got
while configuring with clang++.
To answer one question in advance: There is no leading or trailing
whitespace around '0.1'. I checked this by creating a branch in which I
put angle brackets around the last two instances of '%s' in the printf()
call above.
That implies that when running try.c, clang++ is calculating different
values for '*expect' and '*got' above line 10429. Moreover, clang++ is
getting different values both when calculating 'gcvt' and -- more
surprisingly -- when calculating 'sprintf'.
To answer another question in advance: I don't get this difference when
compiling gcc versus g++.
Is this a bug in clang++? Or is it a bug in ./Configure?
Thank you very much.
Jim Keenan
# Please include the string: [perl #134375]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/Ticket/Display.html?id=134375 >
[The following is probably relevant to
https://rt.perl.org/Ticket/Display.html?id=134371, but I'm filing it
separately as it may be a more general problem.]
When I select '-Dcc=clang++', as distinct from '-Dcc=clang', ./Configure
produces different results. This difference appears to be independent
of both operating system and other configuration options.
Suppose first that I configure blead
(7654aaa1134e4908a6a6dc0b85d360816e79faa3, Aug 17 2019) on Linux as follows:
#####
sh ./Configure -de -Dusedevel -Dcc=clang
#####
... and then record the output of ./Configure in a file.
Next, suppose I clean the checkout then reconfigure and re-record the
output as follows:
#####
sh ./Configure -de -Dusedevel -Dcc=clang++
#####
Here are the compiler versions:
#####
$ clang --version; clang++ --version
clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
#####
If I diff the two output files, I get several differences, but the
following appears to be most significant:
#####
766c779,786
< I'll use gcvt to convert floats into a string.
---
> gcvt oddity: Expected 0.1, got 0.1
> ...But gcvt didn't work as I expected.
> Trying sprintf...
> sprintf() found.
> sprintf oddity: Expected 0.1, got 0.1
> ...But sprintf didn't work as I expected.
> *** WHOA THERE!!! ***
> None of ( gconvert gcvt sprintf) seemed to work properly. I'll use
sprintf.
#####
./Configure composes and runs a number of C programs on the fly as
probes. This file is typically named 'try.c'; the content of 'try.c' is
redefined several times during ./Configure. The relevant try.c starts
shortly after this comment at line 10370: ": Check how to convert floats
to strings." Within this C program we define a function called 'checkit()'.
#####
10429 int checkit(char *expect, char *got)
10430 {
10431 if (strcmp(expect, got)) {
10432 printf("%s oddity: Expected %s, got %s\n",
10433 myname, expect, got);
10434 exit(1);
10435 }
10436 }
#####
Line 10432 above is the source of the surprising output above that I got
while configuring with clang++.
To answer one question in advance: There is no leading or trailing
whitespace around '0.1'. I checked this by creating a branch in which I
put angle brackets around the last two instances of '%s' in the printf()
call above.
That implies that when running try.c, clang++ is calculating different
values for '*expect' and '*got' above line 10429. Moreover, clang++ is
getting different values both when calculating 'gcvt' and -- more
surprisingly -- when calculating 'sprintf'.
To answer another question in advance: I don't get this difference when
compiling gcc versus g++.
Is this a bug in clang++? Or is it a bug in ./Configure?
Thank you very much.
Jim Keenan