DPDK patches and discussions
 help / color / mirror / Atom feed
From: bugzilla@dpdk.org
To: dev@dpdk.org
Subject: [DPDK/core Bug 1409] arparse library assumes enum are 64 bit
Date: Sat, 30 Mar 2024 02:58:41 +0000	[thread overview]
Message-ID: <bug-1409-3@http.bugs.dpdk.org/> (raw)

[-- Attachment #1: Type: text/plain, Size: 1479 bytes --]

https://bugs.dpdk.org/show_bug.cgi?id=1409

            Bug ID: 1409
           Summary: arparse library assumes enum are 64 bit
           Product: DPDK
           Version: 24.03
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: Normal
         Component: core
          Assignee: dev@dpdk.org
          Reporter: stephen@networkplumber.org
  Target Milestone: ---

MSVC correctly flags that this line in rte_argparse.h is incorrect:
        RTE_ARGPARSE_ARG_RESERVED_FIELD = RTE_GENMASK64(63, 48),

The problem is that enum values are just an alias for int, and it can be 32
bits.

Taken from the current C Standard (C99):
 http://www.open std.org/JTC1/SC22/WG14/www/docs/n1256.pdf

6.7.2.2 Enumeration specifiers
[...]
Constraints
The expression that defines the value of an enumeration constant shall be an
integer constant expression that has a value representable as an int.
[...]
Each enumerated type shall be compatible with char, a signed integer type, or
an unsigned integer type. The choice of type is implementation-defined, but
shall be capable of representing the values of all the members of the
enumeration.

Since rte_argparse only uses 10 bits now. The suggested fix here is to:
   1. Assume 32 bits
   2. Get rid of the reserved field - reserved fields are bad idea

-- 
You are receiving this mail because:
You are the assignee for the bug.

[-- Attachment #2: Type: text/html, Size: 3376 bytes --]

             reply	other threads:[~2024-03-30  2:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-30  2:58 bugzilla [this message]
2024-04-01 17:20 ` Tyler Retzlaff
2024-04-01 19:34   ` Stephen Hemminger
2024-04-01 23:49     ` Tyler Retzlaff
2024-10-18 14:58 ` bugzilla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-1409-3@http.bugs.dpdk.org/ \
    --to=bugzilla@dpdk.org \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).