Discussion:
[ast-developers] Build warnings in ast-ksh.2013-06-13... / was: Re: ast-ksh alpha 2013-06-13 source posted
Roland Mainz
2013-06-18 13:24:27 UTC
Permalink
ast-ksh alpha 2013-06-13 source posted to
http://www.research.att.com/sw/download/alpha/
still a work in progess, but progress has been made in the
handling of signals in libast/vmalloc and ksh
more comments later this morning ...
Thanks... :-)

... here are some build warnings which may trigger issues with some
compilers (warnings are from SuSE 12.3/AMD64/64bit build with gcc
4.7):
-- snip --
1. Build warnings in the memory allocation subsystem (note: the
"strict-aliasing" warnings are very important and can trigger major
issues with "clang"):
/home/test001/work/ast_ksh_20130613/build_i386_64bit_opt/src/lib/libast/vmalloc/vmbest.c:
In function 'chktree':
/home/test001/work/ast_ksh_20130613/build_i386_64bit_opt/src/lib/libast/vmalloc/vmbest.c:180:4:
warning: dereferencing type-punned pointer will break strict-aliasing
rules [-Wstrict-aliasing]
/home/test001/work/ast_ksh_20130613/build_i386_64bit_opt/src/lib/libast/vmalloc/vmbest.c:182:4:
warning: dereferencing type-punned pointer will break strict-aliasing
rules [-Wstrict-aliasing]
/home/test001/work/ast_ksh_20130613/build_i386_64bit_opt/src/lib/libast/vmalloc/vmbest.c:
In function 'bestlistreclaim':
/home/test001/work/ast_ksh_20130613/build_i386_64bit_opt/src/lib/libast/vmalloc/vmbest.c:487:5:
warning: dereferencing type-punned pointer will break strict-aliasing
rules [-Wstrict-aliasing]
/home/test001/work/ast_ksh_20130613/build_i386_64bit_opt/src/lib/libast/vmalloc/vmbest.c:506:3:
warning: dereferencing type-punned pointer will break strict-aliasing
rules [-Wstrict-aliasing]
/home/test001/work/ast_ksh_20130613/build_i386_64bit_opt/src/lib/libast/vmalloc/vmbest.c:507:3:
warning: dereferencing type-punned pointer will break strict-aliasing
rules [-Wstrict-aliasing]
/home/test001/work/ast_ksh_20130613/build_i386_64bit_opt/src/lib/libast/vmalloc/vmbest.c:
In function 'bestpackalloc':
/home/test001/work/ast_ksh_20130613/build_i386_64bit_opt/src/lib/libast/vmalloc/vmbest.c:576:3:
warning: dereferencing type-punned pointer will break strict-aliasing
rules [-Wstrict-aliasing]
/home/test001/work/ast_ksh_20130613/build_i386_64bit_opt/src/lib/libast/vmalloc/vmbest.c:605:5:
warning: dereferencing type-punned pointer will break strict-aliasing
rules [-Wstrict-aliasing]
/home/test001/work/ast_ksh_20130613/build_i386_64bit_opt/src/lib/libast/vmalloc/vmbest.c:
In function 'bestresize':
/home/test001/work/ast_ksh_20130613/build_i386_64bit_opt/src/lib/libast/vmalloc/vmbest.c:825:5:
warning: dereferencing type-punned pointer will break strict-aliasing
rules [-Wstrict-aliasing]
/home/test001/work/ast_ksh_20130613/build_i386_64bit_opt/src/lib/libast/vmalloc/vmbest.c:
In function '_vmchkaddress':
/home/test001/work/ast_ksh_20130613/build_i386_64bit_opt/src/lib/libast/vmalloc/vmbest.c:1047:3:
warning: implicit declaration of function '_vmmessage'
[-Wimplicit-function-declaration]

2. Build warnings related to signals:
+ cc '-DSHOPT_CMDLIB_BLTIN=0' '-DSH_CMDLIB_DIR="/usr/ast/bin"'
'-DSHOPT_CMDLIB_HDR="/home/test001/work/ast_ksh_20130613/build_i386_64bit_opt/tmp_gnulinux_builtin_header.h"'
-DSHOPT_SYSRC '-D_map_libc=1' -O2 -fstrict-aliasing -Wstrict-aliasing
-Wsequence-point -Wno-parentheses -Wno-unused -Wno-trigraphs
-Wclobbered -Waddress -I.
-I/home/test001/work/ast_ksh_20130613/build_i386_64bit_opt/src/cmd/ksh93
-Iinclude -I/home/test001/work/ast_ksh_20130613/build_i386_64bit_opt/src/cmd/ksh93/include
-I/home/test001/work/ast_ksh_20130613/build_i386_64bit_opt/arch/linux.i386-64/include/ast
-DSHOPT_STATS -DSHOPT_NAMESPACE -DSHOPT_PFSH -DSHOPT_MULTIBYTE
-DSHOPT_COSHELL -DSHOPT_AUDIT '-D_API_ast=20121001' -D_PACKAGE_ast
-DSHOPT_DYNAMIC '-DERROR_CONTEXT_T=Error_context_t' -DSHOPT_POLL
-D_BLD_shell -DSHOPT_KIA -DKSHELL -DSHOPT_EDPREDICT -DSHOPT_FIXEDARRAY
-DSHOPT_SUID_EXEC -DSHOPT_BRACEPAT -c
/home/test001/work/ast_ksh_20130613/build_i386_64bit_opt/src/cmd/ksh93/sh/init.c
/home/test001/work/ast_ksh_20130613/build_i386_64bit_opt/src/cmd/ksh93/sh/init.c:
In function 'sh_setsiginfo':
/home/test001/work/ast_ksh_20130613/build_i386_64bit_opt/src/cmd/ksh93/sh/init.c:2087:13:
warning: operation on 'np->nvsize' may be undefined [-Wsequence-point]
/home/test001/work/ast_ksh_20130613/build_i386_64bit_opt/src/cmd/ksh93/sh/init.c:2090:13:
warning: operation on 'np->nvsize' may be undefined [-Wsequence-point]
-- snip --

----

Bye,
Roland
--
__ . . __
(o.\ \/ /.o) roland.mainz at nrubsig.org
\__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer
/O /==\ O\ TEL +49 641 3992797
(;O/ \/ \O;)
Glenn Fowler
2013-06-18 14:59:57 UTC
Permalink
Post by Roland Mainz
ast-ksh alpha 2013-06-13 source posted to
http://www.research.att.com/sw/download/alpha/
still a work in progess, but progress has been made in the
handling of signals in libast/vmalloc and ksh
more comments later this morning ...
Thanks... :-)
... here are some build warnings which may trigger issues with some
compilers (warnings are from SuSE 12.3/AMD64/64bit build with gcc
-- snip --
1. Build warnings in the memory allocation subsystem (note: the
"strict-aliasing" warnings are very important and can trigger major
right, code malloc without aliasing and pointer punning ...

do you recall if we got rid of the strict-aliasing warnings in the previous
vmalloc implementation?
Roland Mainz
2013-06-18 16:01:26 UTC
Permalink
Post by Glenn Fowler
Post by Roland Mainz
ast-ksh alpha 2013-06-13 source posted to
http://www.research.att.com/sw/download/alpha/
still a work in progess, but progress has been made in the
handling of signals in libast/vmalloc and ksh
more comments later this morning ...
Thanks... :-)
... here are some build warnings which may trigger issues with some
compilers (warnings are from SuSE 12.3/AMD64/64bit build with gcc
-- snip --
1. Build warnings in the memory allocation subsystem (note: the
"strict-aliasing" warnings are very important and can trigger major
right, code malloc without aliasing and pointer punning ...
Mhhh... aliasing occurs when the compiler has two different pointers
to the same chunk of memory... and by (type-)casting a pointer you are
generating a new (temporary) pointer. Things may go wrong badly if the
optimiser reorders the machine instructions (for example) and issues
something like a read before a write to the same address (through
different (temporary) pointers). This is why gcc complains and
"clang"-build executables trip over such issues.

The problem is now... this is a |union| ... the mortal enemy of strict
aliasing... ;-(

See http://dbp-consulting.com/tutorials/StrictAliasing.html for general help...
Post by Glenn Fowler
do you recall if we got rid of the strict-aliasing warnings in the previous
vmalloc implementation?
No... not without diffing all the sources release-by-release... that's
where svn/git/etc. with something like LXR, GitWeb or (preferably)
OpenGrok (should I start ranting about BugZilla ? ;-(( ) would be very
very usefull... ;-/

... grrr... digging....
... grrr... digging....
... grrr... digging....
... grrr... digging....

... the only one I could find was...
-- snip --
10-11-10 regex/regnexec.c,vmalloc/vmstat.c: eliminate strict-aliasing puns
-- snip --

... which refers to the following diff for vmalloc...

-- snip --
diff -r -u ast_ksh_20101026/build_sparc_64bit_opt/src/lib/libast/vmalloc/vmstat.c
ast_ksh_20101112/build_sparc_64bit_opt/src/lib/libast//vmalloc/vmstat.c
--- ast_ksh_20101026/build_sparc_64bit_opt/src/lib/libast/vmalloc/vmstat.c
Thu Apr 8 18:03:14 2010
+++ ast_ksh_20101112/build_sparc_64bit_opt/src/lib/libast//vmalloc/vmstat.c
Wed Nov 10 08:36:23 2010
@@ -91,7 +91,10 @@
}
else /* get the real size */
{ if(vd->mode&VM_MTDEBUG)
- s = DBSIZE(DB2DEBUG(DATA(b)));
+ { /* strict-aliasing dance */
+ void* d = DB2DEBUG(DATA(b));
+ s = DBSIZE(d);
+ }
else if(vd->mode&VM_MTPROFILE)
s = PFSIZE(DATA(b));
if(s > st->m_busy)
-- snip --

... and the following diff for regex...

-- snip --
--- ast_ksh_20101026/build_sparc_64bit_opt/src/lib/libast/regex/regnexec.c
Fri Dec 11 06:21:20 2009
+++ ast_ksh_20101112/build_sparc_64bit_opt/src/lib/libast//regex/regnexec.c
Wed Nov 10 08:30:03 2010
@@ -234,10 +234,9 @@
regmatch_t save[1];
} Match_frame_t;

-#define matchframe stkdata(stkstd,Match_frame_t)
#define matchpush(e,x) ((x)->re.group.number?_matchpush(e,x):0)
-#define matchcopy(e,x)
((x)->re.group.number?memcpy(matchframe->match,matchframe->save,matchframe->size):(void*)0)
-#define matchpop(e,x)
((x)->re.group.number?memcpy(matchframe->match,matchframe->save,matchframe->size),stkpop(stkstd):(void*)0)
+#define matchcopy(e,x) do if ((x)->re.group.number) { Match_frame_t*
fp = (void*)stkframe(stkstd)->data; memcpy(fp->match, fp->save,
fp->size); } while (0)
+#define matchpop(e,x) do if ((x)->re.group.number) { Match_frame_t*
fp = (void*)stkframe(stkstd)->data; memcpy(fp->match, fp->save,
fp->size); stkpop(stkstd); } while (0)

#define pospop(e) (--(e)->pos->cur)
-- snip --

... does that help somehow ? :-)

----

Bye,
Roland
--
__ . . __
(o.\ \/ /.o) roland.mainz at nrubsig.org
\__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer
/O /==\ O\ TEL +49 641 3992797
(;O/ \/ \O;)
Glenn Fowler
2013-06-19 06:20:26 UTC
Permalink
strict-aliasing warnings gone for the next alpha
thanks
Post by Roland Mainz
Post by Glenn Fowler
Post by Roland Mainz
ast-ksh alpha 2013-06-13 source posted to
http://www.research.att.com/sw/download/alpha/
still a work in progess, but progress has been made in the
handling of signals in libast/vmalloc and ksh
more comments later this morning ...
Thanks... :-)
... here are some build warnings which may trigger issues with some
compilers (warnings are from SuSE 12.3/AMD64/64bit build with gcc
-- snip --
1. Build warnings in the memory allocation subsystem (note: the
"strict-aliasing" warnings are very important and can trigger major
right, code malloc without aliasing and pointer punning ...
Mhhh... aliasing occurs when the compiler has two different pointers
to the same chunk of memory... and by (type-)casting a pointer you are
generating a new (temporary) pointer. Things may go wrong badly if the
optimiser reorders the machine instructions (for example) and issues
something like a read before a write to the same address (through
different (temporary) pointers). This is why gcc complains and
"clang"-build executables trip over such issues.
The problem is now... this is a |union| ... the mortal enemy of strict
aliasing... ;-(
See http://dbp-consulting.com/tutorials/StrictAliasing.html for general help...
Post by Glenn Fowler
do you recall if we got rid of the strict-aliasing warnings in the previous
vmalloc implementation?
No... not without diffing all the sources release-by-release... that's
where svn/git/etc. with something like LXR, GitWeb or (preferably)
OpenGrok (should I start ranting about BugZilla ? ;-(( ) would be very
very usefull... ;-/
... grrr... digging....
... grrr... digging....
... grrr... digging....
... grrr... digging....
... the only one I could find was...
-- snip --
10-11-10 regex/regnexec.c,vmalloc/vmstat.c: eliminate strict-aliasing puns
-- snip --
... which refers to the following diff for vmalloc...
-- snip --
diff -r -u ast_ksh_20101026/build_sparc_64bit_opt/src/lib/libast/vmalloc/vmstat.c
ast_ksh_20101112/build_sparc_64bit_opt/src/lib/libast//vmalloc/vmstat.c
--- ast_ksh_20101026/build_sparc_64bit_opt/src/lib/libast/vmalloc/vmstat.c
Thu Apr 8 18:03:14 2010
+++ ast_ksh_20101112/build_sparc_64bit_opt/src/lib/libast//vmalloc/vmstat.c
Wed Nov 10 08:36:23 2010
@@ -91,7 +91,10 @@
}
else /* get the real size */
{ if(vd->mode&VM_MTDEBUG)
- s = DBSIZE(DB2DEBUG(DATA(b)));
+ { /* strict-aliasing dance */
+ void* d = DB2DEBUG(DATA(b));
+ s = DBSIZE(d);
+ }
else if(vd->mode&VM_MTPROFILE)
s = PFSIZE(DATA(b));
if(s > st->m_busy)
-- snip --
... and the following diff for regex...
-- snip --
--- ast_ksh_20101026/build_sparc_64bit_opt/src/lib/libast/regex/regnexec.c
Fri Dec 11 06:21:20 2009
+++ ast_ksh_20101112/build_sparc_64bit_opt/src/lib/libast//regex/regnexec.c
Wed Nov 10 08:30:03 2010
@@ -234,10 +234,9 @@
regmatch_t save[1];
} Match_frame_t;
-#define matchframe stkdata(stkstd,Match_frame_t)
#define matchpush(e,x) ((x)->re.group.number?_matchpush(e,x):0)
-#define matchcopy(e,x)
((x)->re.group.number?memcpy(matchframe->match,matchframe->save,matchframe->size):(void*)0)
-#define matchpop(e,x)
((x)->re.group.number?memcpy(matchframe->match,matchframe->save,matchframe->size),stkpop(stkstd):(void*)0)
+#define matchcopy(e,x) do if ((x)->re.group.number) { Match_frame_t*
fp = (void*)stkframe(stkstd)->data; memcpy(fp->match, fp->save,
fp->size); } while (0)
+#define matchpop(e,x) do if ((x)->re.group.number) { Match_frame_t*
fp = (void*)stkframe(stkstd)->data; memcpy(fp->match, fp->save,
fp->size); stkpop(stkstd); } while (0)
#define pospop(e) (--(e)->pos->cur)
-- snip --
... does that help somehow ? :-)
----
Bye,
Roland
--
__ . . __
(o.\ \/ /.o) roland.mainz at nrubsig.org
\__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer
/O /==\ O\ TEL +49 641 3992797
(;O/ \/ \O;)
David Korn
2013-06-18 15:59:41 UTC
Permalink
cc: roland.mainz at nrubsig.org
Subject: Re: [ast-developers] Build warnings in ast-ksh.2013-06-13... / was: Re: ast-ksh alpha 2013-06-13 source posted
--------
Post by Roland Mainz
+ cc '-DSHOPT_CMDLIB_BLTIN=0' '-DSH_CMDLIB_DIR="/usr/ast/bin"'
'-DSHOPT_CMDLIB_HDR="/home/test001/work/ast_ksh_20130613/build_i386_64bit_opt/tm
p_gnulinux_builtin_header.h"'
-DSHOPT_SYSRC '-D_map_libc=1' -O2 -fstrict-aliasing -Wstrict-aliasing
-Wsequence-point -Wno-parentheses -Wno-unused -Wno-trigraphs
-Wclobbered -Waddress -I.
-I/home/test001/work/ast_ksh_20130613/build_i386_64bit_opt/src/cmd/ksh93
-Iinclude -I/home/test001/work/ast_ksh_20130613/build_i386_64bit_opt/src/cmd/ksh
93/include
-I/home/test001/work/ast_ksh_20130613/build_i386_64bit_opt/arch/linux.i386-64/in
clude/ast
-DSHOPT_STATS -DSHOPT_NAMESPACE -DSHOPT_PFSH -DSHOPT_MULTIBYTE
-DSHOPT_COSHELL -DSHOPT_AUDIT '-D_API_ast=20121001' -D_PACKAGE_ast
-DSHOPT_DYNAMIC '-DERROR_CONTEXT_T=Error_context_t' -DSHOPT_POLL
-D_BLD_shell -DSHOPT_KIA -DKSHELL -DSHOPT_EDPREDICT -DSHOPT_FIXEDARRAY
-DSHOPT_SUID_EXEC -DSHOPT_BRACEPAT -c
/home/test001/work/ast_ksh_20130613/build_i386_64bit_opt/src/cmd/ksh93/sh/init.c
/home/test001/work/ast_ksh_20130613/build_i386_64bit_opt/src/cmd/ksh93/sh/init.c
/home/test001/work/ast_ksh_20130613/build_i386_64bit_opt/src/cmd/ksh93/sh/init.c
warning: operation on 'np->nvsize' may be undefined [-Wsequence-point]
/home/test001/work/ast_ksh_20130613/build_i386_64bit_opt/src/cmd/ksh93/sh/init.c
warning: operation on 'np->nvsize' may be undefined [-Wsequence-point]
Fixed in the next update.

David Korn
dgk at research.att.com
Loading...