git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Fix type-punning issues

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
May 12, 2009, 08:13 UTC
Message-ID
<alpine.DEB.1.00.0905121012430.27348@pacific.mpi-cbg.de>
In-Reply-To
<1242091058-25197-1-git-send-email-dpmcgee@gmail.com>
Hi,
On Mon, 11 May 2009, Dan McGee wrote:
Show 9 quoted lines
> In these two places we are casting part of our unsigned char sha1 array 
> into an unsigned int, which violates GCCs strict-aliasing rules (and 
> probably other compilers). In addition, we had two hashing functions 
> defined in object.c. Keep the one function that is "correct" and adopt 
> the other ones to fit.
> 
> decorate.c: In function ‘hash_obj’:
> decorate.c:11: warning: dereferencing type-punned pointer will break
> strict-aliasing rules

FWIW we have the same issue in msysGit, having installed GCC 4.4.0 recently, but I did not dare to send my "fix". Yours is much nicer.

Thanks, Dscho

Previous: Junio C Hamano
Message 9 of 9 in “Fix type-punning issues”
  1. Fix type-punning issuesDan McGee, May 12, 2009
  2. Junio C HamanoMay 12, 2009
  3. Dan McGeeMay 19, 2009
  4. 1/3 Unify signedness in hashing callsDan McGee, May 19, 2009
  5. 2/3 Convert hash functions to char instead of struct objectDan McGee, May 19, 2009
  6. 3/3 Unify sha1 char hash functionsDan McGee, May 19, 2009
  7. Johannes SixtMay 19, 2009
  8. Junio C HamanoMay 19, 2009
  9. Johannes SchindelinMay 12, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.