bugmake - Bugs: bug #16788, 'ORDINARY_MTIME_MAX' macro causes...

 
 

bug #16788: 'ORDINARY_MTIME_MAX' macro causes integral constant overflow

Submitted by:  None
Submitted on:  Thu 08 Jun 2006 07:09:44 PM UTC  
 
Severity: 3 - NormalItem Group: Enhancement
Status: NonePrivacy: Public
Assigned to: NoneOpen/Closed: Open
Component Version: 3.81Operating System: MS Windows
Fixed Release: NoneTriage Status: None

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Tue 22 Oct 2013 04:25:47 PM UTC, comment #2:

Paul (Eggert) provided these macros; they are intended to work properly in various endianness, sizeof(int), sizeof(uintmax_t), etc. environments. There's something a little tricky about them related to overflow handling, in order to cause compile-time decisions instead of run-time decisions I think, but I can't remember what it is. The ChangeLog.2 entry at 2000-06-10 has a few details. I think this is probably OK but I'd like to look at it again and make sure I understand what's going on.

Paul D. Smith <psmith>
Project Administrator
Tue 22 Oct 2013 04:09:02 PM UTC, comment #1:

Paul,

The OP suggests to replace this:

#define ORDINARY_MTIME_MAX ((FILE_TIMESTAMP_S (NEW_MTIME) \
<< FILE_TIMESTAMP_LO_BITS) \
+ ORDINARY_MTIME_MIN + FILE_TIMESTAMPS_PER_S - 1)

with this:

#define ORDINARY_MTIME_MAX ((FILE_TIMESTAMP_S (NEW_MTIME) \
<< FILE_TIMESTAMP_LO_BITS) \
+ ORDINARY_MTIME_MIN - 1 + FILE_TIMESTAMPS_PER_S)

(in filedef.h).

This looks as a no-brainer to me, so if you don't object, I will make that change.

Eli Zaretskii <eliz>
Project Member
Thu 08 Jun 2006 07:09:44 PM UTC, original submission:

Abstract: The macro causes a compiler warning. Workaround: rearrange the additions. The details are attached in XML below.

<bug-report>
<behaviour>
<location path="make-3.81/file.c" line="775">
FILE_TIMESTAMP_S (ORDINARY_MTIME_MAX)
</location>
<output>
warning C4307: '+' : integral constant overflow
</output>
</behaviour>
<reason>
The warning is caused by the addition (FILE_TIMESTAMP_S (NEW_MTIME) &lt;&lt; FILE_TIMESTAMP_LO_BITS) + ORDINARY_MTIME_MIN + FILE_TIMESTAMPS_PER_S
</reason>
<remedy>
<location path="make-3.81/filedef.h" line="188">
#define ORDINARY_MTIME_MAX ((FILE_TIMESTAMP_S (NEW_MTIME) \
&lt;&lt; FILE_TIMESTAMP_LO_BITS) \
+ ORDINARY_MTIME_MIN - 1 + FILE_TIMESTAMPS_PER_S)
</location>
</remedy>
</bug-report>

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by psmith (Posted a comment)
  • -unavailable- added by eliz (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    No Changes Have Been Made to This Item

    Back to the top


    Powered by Savane 3.1-cleanup1