#1378 reopened defect (fixed)
Type confusion and strict aliasing in gtfringetable — at Version 1
| Reported by: | Michael Wood-Vasey | Owned by: | eugene |
|---|---|---|---|
| Priority: | low | Milestone: | |
| Component: | Ohana | Version: | |
| Severity: | normal | Keywords: | |
| Cc: |
Description (last modified by )
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 (1)
comment:1 by , 16 years ago
| Description: | modified (diff) |
|---|---|
| Resolution: | → fixed |
| Status: | new → closed |

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