public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/14455] New: roundup macro bug
@ 2012-08-10 23:43 mikulas at artax dot karlin.mff.cuni.cz
  2013-03-07 19:48 ` [Bug libc/14455] " pashev.igor at gmail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: mikulas at artax dot karlin.mff.cuni.cz @ 2012-08-10 23:43 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=14455

             Bug #: 14455
           Summary: roundup macro bug
           Product: glibc
           Version: 2.16
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: unassigned@sourceware.org
        ReportedBy: mikulas@artax.karlin.mff.cuni.cz
                CC: drepper.fsp@gmail.com
    Classification: Unclassified


When the first parameter of a roundup macro is a 64-bit number and the second
parameter is unsigned 32-bit number, the macro misbehaves. You should cast the
second parameter to long long or typeof of the first parameter before calling
the
~ operator.

Try this:

#include <stdio.h>
#include <sys/param.h>

int main(void)
{
        printf("%llx\n", roundup(0x123456789abcdefLL, 4U));
        return 0;
}

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug libc/14455] roundup macro bug
  2012-08-10 23:43 [Bug libc/14455] New: roundup macro bug mikulas at artax dot karlin.mff.cuni.cz
@ 2013-03-07 19:48 ` pashev.igor at gmail dot com
  2014-06-17 18:46 ` fweimer at redhat dot com
  2014-06-25 10:50 ` fweimer at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: pashev.igor at gmail dot com @ 2013-03-07 19:48 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=14455

Igor Pashev <pashev.igor at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pashev.igor at gmail dot
                   |                            |com

--- Comment #1 from Igor Pashev <pashev.igor at gmail dot com> 2013-03-07 19:47:39 UTC ---
(In reply to comment #0)
> When the first parameter of a roundup macro is a 64-bit number and the second
> parameter is unsigned 32-bit number, the macro misbehaves. You should cast the
> second parameter to long long or typeof of the first parameter before calling
> the
> ~ operator.
> 
> Try this:
> 
> #include <stdio.h>
> #include <sys/param.h>
> 
> int main(void)
> {
>         printf("%llx\n", roundup(0x123456789abcdefLL, 4U));
>         return 0;
> }

Probably, both args must be of the same width [1]

[1] https://blogs.oracle.com/jwadams/entry/macros_and_powers_of_two

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug libc/14455] roundup macro bug
  2012-08-10 23:43 [Bug libc/14455] New: roundup macro bug mikulas at artax dot karlin.mff.cuni.cz
  2013-03-07 19:48 ` [Bug libc/14455] " pashev.igor at gmail dot com
@ 2014-06-17 18:46 ` fweimer at redhat dot com
  2014-06-25 10:50 ` fweimer at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: fweimer at redhat dot com @ 2014-06-17 18:46 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=14455

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fweimer at redhat dot com

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug libc/14455] roundup macro bug
  2012-08-10 23:43 [Bug libc/14455] New: roundup macro bug mikulas at artax dot karlin.mff.cuni.cz
  2013-03-07 19:48 ` [Bug libc/14455] " pashev.igor at gmail dot com
  2014-06-17 18:46 ` fweimer at redhat dot com
@ 2014-06-25 10:50 ` fweimer at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: fweimer at redhat dot com @ 2014-06-25 10:50 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=14455

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
              Flags|                            |security-

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-06-25 10:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-10 23:43 [Bug libc/14455] New: roundup macro bug mikulas at artax dot karlin.mff.cuni.cz
2013-03-07 19:48 ` [Bug libc/14455] " pashev.igor at gmail dot com
2014-06-17 18:46 ` fweimer at redhat dot com
2014-06-25 10:50 ` fweimer at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).