https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119524

            Bug ID: 119524
           Summary: cobol: gg_printf assumes target characteristics
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: cobol
          Assignee: unassigned at gcc dot gnu.org
          Reporter: iains at gcc dot gnu.org
  Target Milestone: ---
            Target: *-darwin*

gg_printf outputs code that attempts to call fprintf (stderr, ...) on the
target.

this is used by "PACKED-DECIMAL_dump" which fails on x86_64-darwin.

This is because the implementation does not have any mechanism to check the
spelling of "stderr" on specific targets (or, I guess, if the target even
supports this).

On Darwin when headers are included "stderr" gets mapped to "__stderrp" and if
we temporarily change the code to use this, the test case passes.  With the
current code, we fail at link time because "stderr" is not defined.

One solution would be to add a new target hook to allow FEs to discover the
spelling of stdin/stdout/stderr globals.

However probably it would be easier to move gg_printf () to the runtime
library, where it could be built with target headers and therefore avoid the
issue?
(so that the dump routine would synthesise a call to the runtime?)

Reply via email to