IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Opened 16 years ago

Last modified 16 years ago

#1378 reopened defect

Type confusion and strict aliasing in gtfringetable

Reported by: Michael Wood-Vasey Owned by: eugene
Priority: low Milestone:
Component: Ohana Version:
Severity: normal Keywords:
Cc:

Description (last modified by eugene)

Paul says
"""
off_t is probably defined as "long int" instead of "long long int", in which case the cast is inappropriate.

The quickest workaround would be to turn of -Werr in the Makefile.
"""

but this looks general so should be fixed.

Joel reported to this to the ps-ipp-dev list last week.

"""
/home/giga/temp/PS1/src/ipp/Ohana/src/misc/src/gtfringetable.c: In function ‘main’:
/home/giga/temp/PS1/src/ipp/Ohana/src/misc/src/gtfringetable.c:38: warning: dereferencing type-punned pointer will break strict-aliasing rules
/home/giga/temp/PS1/src/ipp/Ohana/src/misc/src/gtfringetable.c:39: warning: dereferencing type-punned pointer will break strict-aliasing rules
/home/giga/temp/PS1/src/ipp/Ohana/src/misc/src/gtfringetable.c:40: warning: dereferencing type-punned pointer will break strict-aliasing rules
/home/giga/temp/PS1/src/ipp/Ohana/src/misc/src/gtfringetable.c:41: warning: dereferencing type-punned pointer will break strict-aliasing rules
"""

Change History (4)

comment:1 by eugene, 16 years ago

Description: modified (diff)
Resolution: fixed
Status: newclosed

This issue is caused by the difficulty of printing/scanning data of off_t type. Since the off_t type can vary in size between systems, a single print format cannot be used. This specific issue was driven by the inappropriate use of casting to get around this problem -- the casting sometimes violated optimization rules.

This issue has been addressed by reworking the code to use an implementation-dependent print format code 'OFF_T_FMT', which depends on the state of the LARGEFILE configuration. This macro is sometimes set of %ld and sometimes to %jd (appropriate for intmax_t).

fix is on the trunk in r28241

comment:2 by Michael Wood-Vasey, 16 years ago

Resolution: fixed
Status: closedreopened

This has popped up again in Ohana/src/tools/src/ftable.c. Turning of Werror let's complication continue.


gcc -O2 -std=gnu89 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -Werror -DHAVE_MYSQL_H -I/home/depot/wmwv/PS1/src/ipp/Ohana/src/tools/include -I/home/depot/wmwv/PS1/code/default.linux/include -I/usr/include -I/usr/local/include/vtk -I/home/depot/wmwv/PS1/code/default.linux/include -I/home/depot/wmwv/PS1/code/default.linux/include/mysql -Dlinux -c /home/depot/wmwv/PS1/src/ipp/Ohana/src/tools/src/ftable.c -o /home/depot/wmwv/PS1/src/ipp/Ohana/src/tools/src/ftable.linux.o
cc1: warnings being treated as errors
/home/depot/wmwv/PS1/src/ipp/Ohana/src/tools/src/ftable.c: In function ‘print_column’:
/home/depot/wmwv/PS1/src/ipp/Ohana/src/tools/src/ftable.c:346: warning: dereferencing type-punned pointer will break strict-aliasing rules
make[2]: * home/depot/wmwv/PS1/src/ipp/Ohana/src/tools/src/ftable.linux.o Error 1
---

comment:3 by Michael Wood-Vasey, 16 years ago

Sorry for forgetting OS and gcc. This was SCiLinux 5.5 with gcc 4.1.2

[wmwv@ra psconfig]$ uname -a
Linux ra.phyast.pitt.edu 2.6.18-194.8.1.el5PAE #1 SMP Thu Jul 1 16:40:49 EDT 2010 i686 i686 i386 GNU/Linux
[wmwv@ra psconfig]$ gcc --version
gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-48)
[wmwv@ra psconfig]$ cat /etc/redhat-release
Scientific Linux SL release 5.5 (Boron)

comment:4 by Michael Wood-Vasey, 16 years ago

Intel 6-Core i7 CPUs

Note: See TracTickets for help on using tickets.