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

Re: [RFH] gcc constant expression warning...

From
Nicolas Pitre <nico@cam.org>
Date
Oct 29, 2007, 00:55 UTC
Message-ID
<alpine.LFD.0.9999.0710282053590.22100@xanadu.home>
In-Reply-To
<alpine.LFD.0.999.0710281000260.30120@woody.linux-foundation.org>
On Sun, 28 Oct 2007, Linus Torvalds wrote:
Show 16 quoted lines
> 
> 
> On Sun, 28 Oct 2007, Antti-Juhani Kaijanaho wrote:
> >
> > A correct fix would be to check for the size of off_t in some other (and
> > defined) manner, but I don't know off_t well enough to suggest one.
> 
> In this case, it's trying to make sense that "off_t" can hold more than 32
> bits. So I think that test can just be rewritten as
> 
> 	if (sizeof(off_t) <= 4) {
> 		munmap(idx_map, idx_size);
> 		return error("pack too large for current definition of off_t in %s", path);
> 	}
> 
> instead.

The test must also make sure off_t isn't signed, since in that case it can only hold 31 bits.

Nicolas
Previous: Linus TorvaldsNext: Stephen Rothwell
Message 6 of 8 in “[RFH] gcc constant expression warning...”
  1. Junio C HamanoOct 28, 2007
  2. Florian WeimerOct 28, 2007
  3. Daniel BarkalowOct 28, 2007
  4. Antti-Juhani KaijanahoOct 28, 2007
  5. Linus TorvaldsOct 28, 2007
  6. Nicolas PitreOct 29, 2007
  7. Stephen RothwellOct 29, 2007
  8. Linus TorvaldsOct 29, 2007

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.