Undefined behavior in LogConfiguration::configure_stdout.

XMLWordPrintable

    • Type: Bug
    • Resolution: Duplicate
    • Priority: P3
    • 11
    • Affects Version/s: 9, 10
    • Component/s: hotspot
    • generic
    • os_x

      The new XCode9 cannot be used for jdk because it cause a build failure in LogConfiguration::configure_stdout.

      The output is:
      ============================
      open/src/hotspot/share/logging/logConfiguration.cpp:303:16: error: passing an object that undergoes default argument promotion to 'va_start' has undefined behavior [-Werror,-Wvarargs]
        va_start(ap, exact_match);
                     ^
      open/src/hotspot/share/logging/logConfiguration.cpp:299:66: note: parameter of type 'bool' is declared here
      void LogConfiguration::configure_stdout(LogLevelType level, bool exact_match, ...) {
                                                                       ^
      1 error generated.
      ============================

      http://en.cppreference.com/w/cpp/language/variadic_arguments#Default_conversions

      "bool, char, short, and unscoped enumerations are converted to int or wider integer types as in integer promotion "

      "The behavior of the va_start macro is undefined if the last parameter before the ellipsis has reference type, or has type that is not compatible with the type that results from default argument promotions."

            Assignee:
            Marcus Larsson (Inactive)
            Reporter:
            Sergey Bylokhov
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: