On Thu, Oct 24, 2013 at 3:40 PM, Roland Mainz <[email protected]> wrote:
> On Thu, Oct 24, 2013 at 3:04 PM, Glenn Fowler <[email protected]> 
> wrote:
>> On Thu, Oct 24, 2013 at 8:40 AM, Roland Mainz <[email protected]>
>> wrote:
>>> While trying to build a working ksh93 from ast-ksh.2013-10-10 on SuSE
>>> 12.3/AMD/64bit using the PathScale pathcc compiler I hit the following
>>> warnings:
>>> -- snip --
>>> + cc -D_BLD_DLL -fPIC -D_BLD_ast '-DSHOPT_CMDLIB_BLTIN=0'
>>> '-DSH_CMDLIB_DIR="/usr/ast/bin"'
>>>
>>> '-DSHOPT_CMDLIB_HDR="/home/test001/work/ast_ksh_20131010/build_pathcc/tmp_gnulinux_built
>>> in_header.h"' -DSHOPT_SYSRC '-D_map_libc=1' -O2 -fstrict-aliasing
>>> -Wstrict-aliasing -Wsequence-point -Wno-parentheses -Wno-unused
>>> -Wno-trigraphs -Wuninitialized -Waddress -I. -I/h
>>> ome/test001/work/ast_ksh_20131010/build_pathcc/src/lib/libast -Icomp
>>> -I/home/test001/work/ast_ksh_20131010/build_pathcc/src/lib/libast/comp
>>> -Iport -I/home/test001/work/ast_ksh_201
>>> 31010/build_pathcc/src/lib/libast/port -Iinclude
>>> -I/home/test001/work/ast_ksh_20131010/build_pathcc/src/lib/libast/include
>>> -Istd -I/home/test001/work/ast_ksh_20131010/build_pathcc
>>> /src/lib/libast/std -D_PACKAGE_ast -c
>>>
>>> /home/test001/work/ast_ksh_20131010/build_pathcc/src/lib/libast/string/wcstoutf32s.c
>>>
>>> /home/test001/work/ast_ksh_20131010/build_pathcc/src/lib/libast/string/wcstoutf32s.c:48:34:
>>> warning: comparison of unsigned expression < 0 is always false
>>> [-Wtautological-compare]
>>>                         if (mbconv(tmp, wchar[i], &q) < 0)
>>>                             ~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~
>>>
>>> /home/test001/work/ast_ksh_20131010/build_pathcc/src/lib/libast/string/wcstoutf32s.c:64:106:
>>> warning: comparison between pointer and integer ('void *' and 'int')
>>>                 if (ast.mb_wc2uc == (void*)(-1) && (ast.mb_wc2uc =
>>> (void*)iconv_open("UTF-8", codeset(CODESET_ctype))) == -1)
>
>> thx roland
>> this was coded during the rush to fix mb* wc* before losing access to the
>> sw/download/
>> a last minute change was required to get the ast iconv intercept working
>> and the effects of that change were not completely propagated
>>
>> does this fix the 8Gib tr allocation bug?
>
> AFAIK no... this is only for the \w[]/\u[] codepaths which fail in
> various ways if the pathcc compiler optimiser is turned on... I have
> to rework the patch a bit again to weed-out another bug in these two
> source files... updated patch is currently being tested...
[snip]

Attached (as "astksh20131010_pathcc_wcsfixes002.diff.txt") is an
updated patch which deals with "clang" and "pathcc" issues with
constructs like |if (func1(&retval) || retval)| which may break down
in certain conditions so that the 2nd |retval| is evaluated before
|func1()| has returned.

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) [email protected]
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 3992797
 (;O/ \/ \O;)
diff -r -u build_i386_64bit_debug/src/lib/libast/string/utf32stowcs.c 
build_pathcc/src/lib/libast/string/utf32stowcs.c
--- src/lib/libast/string/utf32stowcs.c 2013-09-18 05:37:25.000000000 +0200
+++ src/lib/libast/string/utf32stowcs.c 2013-10-24 15:43:15.187213674 +0200
@@ -46,7 +46,7 @@
                mbinit(&q);
                for (i = 0; i < n; i++)
                {
-                       if (mbconv(tmp, utf32[i], &q) < 0)
+                       if (mbconv(tmp, utf32[i], &q) == (size_t)-1)
                                break;
                        wchar[i] = utf32[i];
                }
@@ -67,6 +67,7 @@
                {
                        char    tmp_in[UTF8_LEN_MAX+1];
                        char    tmp_out[16];
+                       size_t  ires;
 
                        /* this is the branch taken by chresc() and chrexp() */
 
@@ -77,7 +78,8 @@
                        inbuf = tmp_in;
                        outbuf = tmp_out;
                        outbytesleft = sizeof(tmp_out);
-                       if (iconv((iconv_t)ast.mb_uc2wc, &inbuf, &inbytesleft, 
&outbuf, &outbytesleft) < 0 || inbytesleft)
+                       ires = iconv((iconv_t)ast.mb_uc2wc, &inbuf, 
&inbytesleft, &outbuf, &outbytesleft);
+                       if ((ires == (size_t)(-1)) || inbytesleft)
                                return -1;
                        if (!mbwide())
                        {
@@ -102,6 +104,7 @@
                        char*           inbuf_start;
                        char*           outbuf_start;
                        int             oerrno;
+                       size_t          ires;
 
                        outbytesleft    = n * mbmax();
                        outbuf_start    = oldof(0, char, (outbytesleft + 2) + 
(n * UTF8_LEN_MAX + 1), 0);
@@ -115,7 +118,8 @@
                        inbuf           = inbuf_start;
                        outbuf          = outbuf_start;
                        i               = 0;
-                       if (iconv((iconv_t)ast.mb_uc2wc, &inbuf, &inbytesleft, 
&outbuf, &outbytesleft) < 0)
+                       ires = iconv((iconv_t)ast.mb_uc2wc, &inbuf, 
&inbytesleft, &outbuf, &outbytesleft);
+                       if (ires == (size_t)(-1))
                                return -1;
                        inbuf = outbuf;
                        if (mbwide())
diff -r -u build_i386_64bit_debug/src/lib/libast/string/wcstoutf32s.c 
build_pathcc/src/lib/libast/string/wcstoutf32s.c
--- src/lib/libast/string/wcstoutf32s.c 2013-09-17 18:10:56.000000000 +0200
+++ src/lib/libast/string/wcstoutf32s.c 2013-10-24 12:50:35.622567718 +0200
@@ -45,7 +45,7 @@
                mbinit(&q);
                for (i = 0; i < n; i++)
                {
-                       if (mbconv(tmp, wchar[i], &q) < 0)
+                       if (mbconv(tmp, wchar[i], &q) == (size_t)-1)
                                break;
                        utf32[i] = wchar[i];
                }
@@ -61,7 +61,7 @@
                size_t          outbytesleft;
                int             oerrno;
 
-               if (ast.mb_wc2uc == (void*)(-1) && (ast.mb_wc2uc = 
(void*)iconv_open("UTF-8", codeset(CODESET_ctype))) == -1)
+               if (ast.mb_wc2uc == (void*)(-1) && (ast.mb_wc2uc = 
(void*)iconv_open("UTF-8", codeset(CODESET_ctype))) == (void*)(-1))
                        ast.mb_wc2uc = 0;
                if (ast.mb_wc2uc == 0)
                        return -1;
@@ -77,7 +77,7 @@
 
                        mbinit(&q);
                        for (inbuf = inbuf_start, i = 0; i < n; i++, inbuf += 
len)
-                               if ((len = mbconv(inbuf, wchar[i], &q)) < 0)
+                               if ((len = mbconv(inbuf, wchar[i], &q)) == 
(size_t)-1)
                                {
                                        inbuf[i] = 0;
                                        break;
_______________________________________________
ast-developers mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-developers

Reply via email to