[Bug c/24856] New: call to setlocale doesn't return expected value

2005-11-14 Thread tedoc2000 at gmail dot com



-- 
   Summary: call to setlocale doesn't return expected value
   Product: gcc
   Version: 3.4.4
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tedoc2000 at gmail dot com
 GCC build triplet: powerpc-ibm-aix4.3.2.0
  GCC host triplet: powerpc-ibm-aix4.3.2.0
GCC target triplet: powerpc-ibm-aix4.3.2.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24856



[Bug c/24856] call to setlocale doesn't return expected value

2005-11-14 Thread tedoc2000 at gmail dot com


--- Comment #2 from tedoc2000 at gmail dot com  2005-11-14 19:55 ---
I have a very simple program that is trying to call setlocale(LC_ALL,"") to set
the LC_ALL from the enviroment. 
When I run with a gcc3.3.2 compiled binary:
gcc33> ./locale
en_US en_US en_US en_US en_US en_US
en_US en_US en_US en_US en_US en_US

But when I run with gcc 3.4.4 compiled binary I get:
gcc34> ./locale
null
C C C C C C

In both cases I have:
> echo $LANG
en_US
> echo $LC_ALL

The .i files look the same to me except for white space differences
Here is the -v output from the gcc 3.3.2 version:
/opt/OPSWgcc32/bin/gcc -v
Reading specs from
/opt/OPSWgcc32/lib/gcc-lib/powerpc-ibm-aix4.3.2.0/3.3.2/specs
Configured with: ../configure --with-ar=/usr/bin/ar --with-as=/usr/bin/as
--with-ld=/usr/bin/ld --disable-nls --enable-languages=c,c++
--prefix=/opt/OPSWgcc32 --enable-threads --enable-version-specific-runtime-libs
--host=powerpc-ibm-aix4.3.2.0
Thread model: aix
gcc version 3.3.2

And here is the 3.4.4 version:
Reading specs from
/opt/OPSWbuildtools/1.0.1/lib/gcc/powerpc-ibm-aix4.3.2.0/3.4.4/specs
Configured with: ../gcc-3.4.4/configure --disable-shared --with-as=/bin/as
--with-ld=/bin/ld --disable-nls --enable-threads=posix
--with-libiconv-prefix=/opt/OPSWbuildtools/1.0.1
--prefix=/opt/OPSWbuildtools/1.0.1
--with-local-prefix=/opt/OPSWbuildtools/1.0.1
--enable-version-specific-runtime-libs --enable-languages=c,c++
Thread model: aix
gcc version 3.4.4


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24856



[Bug c/24856] call to setlocale doesn't return expected value

2005-11-14 Thread tedoc2000 at gmail dot com


--- Comment #4 from tedoc2000 at gmail dot com  2005-11-14 19:57 ---
Created an attachment (id=10239)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=10239&action=view)
.i file for gcc332


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24856



[Bug c/24856] call to setlocale doesn't return expected value

2005-11-14 Thread tedoc2000 at gmail dot com


--- Comment #5 from tedoc2000 at gmail dot com  2005-11-14 19:58 ---
Created an attachment (id=10240)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=10240&action=view)
.i file for gcc344


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24856



[Bug c/24856] call to setlocale doesn't return expected value

2005-11-14 Thread tedoc2000 at gmail dot com


--- Comment #7 from tedoc2000 at gmail dot com  2005-11-14 20:13 ---
Actually I think it may have to do with libgcc. But I wasn't sure how to file a
bug like that:

Anyway I filed it against gcc because:
a) Both files were compiled on the same server (So no patch level differences)
b) The versions of all the other things I can think of are the same (ar, as,
ln)
c) Both versions of gcc create the same .i file.
d) When I take the .o file and "collect2" against the gcc3.3.2 versions of
libgcc it works as I expect. Here is the "collect2" I used:
opt/OPSWbuildtools/1.0.1/libexec/gcc/powerpc-ibm-aix4.3.2.0/3.4.4/collect2
-bpT:0x1000 -bpD:0x2000 -btextro -bnodelcsect
-bexport:/usr/lib/libg.exp -o locale /lib/crt0.o
-L/opt/OPSWgcc32/lib/gcc-lib/powerpc-ibm-aix4.3.2.0/3.3.2
-L/opt/OPSWgcc32/lib/gcc-lib/powerpc-ibm-aix4.3.2.0/3.3.2/../../.. locale.o
/opt/OPSWgcc32/lib/gcc-lib/powerpc-ibm-aix4.3.2.0/3.3.2/libgcc.a
/opt/OPSWgcc32/lib/gcc-lib/powerpc-ibm-aix4.3.2.0/3.3.2/libgcc_eh.a -lg -lc
/opt/OPSWgcc32/lib/gcc-lib/powerpc-ibm-aix4.3.2.0/3.3.2/libgcc.a
/opt/OPSWgcc32/lib/gcc-lib/powerpc-ibm-aix4.3.2.0/3.3.2/libgcc_eh.a

As opposed to the one I get with gcc3.4.4:
/opt/OPSWbuildtools/1.0.1/libexec/gcc/powerpc-ibm-aix4.3.2.0/3.4.4/collect2
-bpT:0x1000 -bpD:0x2000 -btextro -bnodelcsect
-bexport:/usr/lib/libg.exp -o locale /lib/crt0.o
-L/opt/OPSWbuildtools/1.0.1/lib/gcc/powerpc-ibm-aix4.3.2.0/3.4.4
-L/opt/OPSWbuildtools/1.0.1/lib/gcc/powerpc-ibm-aix4.3.2.0/3.4.4/../../..
locale.o
/opt/OPSWbuildtools/1.0.1/lib/gcc/powerpc-ibm-aix4.3.2.0/3.4.4/libgcc.a -lg -lc
/opt/OPSWbuildtools/1.0.1/lib/gcc/powerpc-ibm-aix4.3.2.0/3.4.4/libgcc.a

e) I'm not so smart? :)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24856



[Bug target/24856] call to setlocale doesn't return expected value

2005-11-14 Thread tedoc2000 at gmail dot com


--- Comment #8 from tedoc2000 at gmail dot com  2005-11-14 20:18 ---
oops I meant ld not ln in b) above


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24856



[Bug target/24856] call to setlocale doesn't return expected value

2005-11-14 Thread tedoc2000 at gmail dot com


--- Comment #10 from tedoc2000 at gmail dot com  2005-11-14 20:39 ---
Hmm..
I'm getting the same exact behaviour on my AIX 5.1 box :/
So maybe it has something to do with the way I configured gcc 3.4.4 (which is a
little different than how I did 3.3.2) 
Let me try re-building 3.4.4 with the same ./configure command line as I did
the gcc 3.3.2

Will see if that does anything.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24856



[Bug target/24856] call to setlocale doesn't return expected value

2005-11-14 Thread tedoc2000 at gmail dot com


--- Comment #11 from tedoc2000 at gmail dot com  2005-11-15 00:59 ---
Okay.. recompiling gcc-3.4.4 with the same options as I used in compiling
gcc-3.3.2 seems to have fixed the problem. 

Now working on figuring out with configure options cause the problem.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24856



[Bug target/24856] call to setlocale doesn't return expected value

2005-11-14 Thread tedoc2000 at gmail dot com


--- Comment #12 from tedoc2000 at gmail dot com  2005-11-15 02:08 ---
--with-local-prefix seems to be causing the problem. Not sure why.
Basically I'm trying to build a set of tools for complining our product that
only references things under a particular root (/opt/OPSWbuildtools/1.0.1 in my
case). As far as I can tell in order to have gcc not look under there I need to
specify --with-local-prefix=/opt/OPSWbuildtools/1.0.1
Am I missing something?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24856



[Bug target/24856] call to setlocale doesn't return expected value

2005-11-15 Thread tedoc2000 at gmail dot com


--- Comment #15 from tedoc2000 at gmail dot com  2005-11-15 21:27 ---
Okay so it wasn't the --with-local-prefix.
It was the fact that I used --prefix=/opt/OPSWbuildtools/1.0.1.
If I use a directory that doesn't already exist then I get my desired results.
So that makes us ask. "Well what do you have in /opt/OPSWbuildtools/1.0.1?"
I will attach a list of the contents. Basically it is an install of
libiconv-1.9.1
gawk-3.1.4
coreutils-5.1.2 
make-3.8.0

The most suspicious of the above(IMHO) is the libiconv.. But even though I am
specifying --with-iconv-prefix=/opt/OPSWbuildtools/1.0.1, I don't see that
being used when linking in gcc/ I just see -liconv. 

The only other visible difference I see is when collect2 runs I see a
-L/opt/OPSWbuildtools/1.0.1/lib. But as my test program doesn't use iconv in
anyway I don't see how that could make a difference.

I'm testing to see if just the existance of the directory but without contents
also causes the same problem.

Back when I have definitive results.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24856



[Bug target/24856] call to setlocale doesn't return expected value

2005-11-15 Thread tedoc2000 at gmail dot com


--- Comment #16 from tedoc2000 at gmail dot com  2005-11-16 02:10 ---
Okay.. So it turns out that having my version of libiconv.a in
/opt/OPSWbuildtools/1.0.1/lib causes the problem.
I compiled it --enable-static --disable-dynamic with gcc 3.3.2..
Seeing if not doing that helps.

As I mentioned in my initial report, I am using
--with-iconv-prefix=/opt/OPSWbuildtools/1.0.1 

I'm still confused how that version of libiconv got pulled in as I see no
reference to -L/opt/OPSWbuildtools/1.0.1 in the build log.

Interestingly when I got rid of /opt/OPSWbuildtools/1.0.1/libiconv.a
I do see references to -L/opt/OPSWbuildtools/1.0.1 in the build logs :/


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24856



[Bug target/24856] call to setlocale doesn't return expected value

2005-11-16 Thread tedoc2000 at gmail dot com


--- Comment #17 from tedoc2000 at gmail dot com  2005-11-16 18:57 ---
Okay.. This definitely seems to be a problem with having libiconv.a in
%{prefix}/lib.
If I move /opt/OPSWbuildtools/1.0.1/lib/libconv.a to
/opt/OPSWbuildtools/1.0.1/lib/libconv.a.blah and run my program, it works as
expected (i.e. I get en_US en_US), but when I put it back then  my program
fails (i.e. I get null, C C C C C)
Seems like and ld problem to me.. My solution will be to move libiconv.a into
/opt/OPSWbuildtools/1.0.1/libiconv.
Sorry for wasting your time.. But at least this behaviour is documented now.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24856