Uploaded image for project: 'MariaDB Connector/C'
  1. MariaDB Connector/C
  2. CONC-789

MARIADB_OPT_STATUS_CALLBACK Variadic around enums is undefined behaviour

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 3.3.17
    • 3.3, 3.4
    • API, Internal
    • None

    Description

      from https://github.com/mariadb-corporation/mariadb-connector-c/commit/a8832afa2aab08ee15b71a5687b50b496d526552

      As found in the compulation of mysql.cc under clang in MDEV-36701

      https://github.com/MariaDB/server/commit/3e43606de6a5c6a0ee180d9c6a0ee73b2480909a

      client/mysql.cc:3205:16: warning: passing an object that undergoes default argument promotion to 'va_start' has undefined behavior [-Wvarargs]
      

      This was probably clang-20.

      https://github.com/mamh-mixed/glusterfs/commit/11ea746

      https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1548.pdf

      7.16.1.4p4
       
      parmN is the identifier of the rightmost parameter in the variable
      parameter list in the function definition (the one just before the , ...). If the parameter
      parmN is declared ... with a type that is not compatible with the type that results after application of the default argument promotions, the behavior is undefined.
       
       
      6.3.1.1p1
       
      The rank of any enumerated type shall equal the rank of the compatible integer type
      (see 6.7.2.2).
       
      6.7.2.2p4
       
      Each enumerated type shall be compatible with char, a signed integer type, or an
      unsigned integer type. The choice of type is implementation-defined
      

      So enums are undergoing a default argument promotion because they might be unsigned in my understanding.

      I'm not sure if its resolvable. Might be possible to be an explicit int type because of the low range of values (does this affect bigendian?)

      Attachments

        Issue Links

          Activity

            People

              georg Georg Richter
              danblack Daniel Black
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.