public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug modula2/102343] New: gm2/cpp/pass/subaddr.mod FAILs for non-default multilib
@ 2021-09-15 11:15 ro at gcc dot gnu.org
  2023-01-17 15:18 ` [Bug modula2/102343] " iains at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: ro at gcc dot gnu.org @ 2021-09-15 11:15 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102343
           Summary: gm2/cpp/pass/subaddr.mod FAILs for non-default
                    multilib
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: modula2
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ro at gcc dot gnu.org
                CC: gaiusmod2 at gmail dot com
  Target Milestone: ---

The gm2/cpp/pass/subaddr.mod test FAILs for non-default multilibs (seen on
x86_64-pc-linux-gnu with -m32 and i386-pc-solaris2.11 with -m64):

FAIL: gm2/cpp/pass/subaddr.mod,  -g  
FAIL: gm2/cpp/pass/subaddr.mod,  -O  
FAIL: gm2/cpp/pass/subaddr.mod,  -O -g  
FAIL: gm2/cpp/pass/subaddr.mod,  -Os  
FAIL: gm2/cpp/pass/subaddr.mod,  -O3 -fomit-frame-pointer  
FAIL: gm2/cpp/pass/subaddr.mod,  -O3 -fomit-frame-pointer -finline-functions  

/vol/gcc/src/git/modula-2/gcc/testsuite/gm2/cpp/pass/subaddr.mod:34:1: error:
can only CAST objects of the same size

Unfortunately, -save-temps has no effect so one cannot see what actual input is
passed to cc1gm2.

Besides, it seems weird to special-case x86_64 and 64-bit alpha (was there ever
a 32-bit port?) when every 64-bit target would already be handled by __LP64__.

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

* [Bug modula2/102343] gm2/cpp/pass/subaddr.mod FAILs for non-default multilib
  2021-09-15 11:15 [Bug modula2/102343] New: gm2/cpp/pass/subaddr.mod FAILs for non-default multilib ro at gcc dot gnu.org
@ 2023-01-17 15:18 ` iains at gcc dot gnu.org
  2023-01-17 16:52 ` iains at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: iains at gcc dot gnu.org @ 2023-01-17 15:18 UTC (permalink / raw)
  To: gcc-bugs

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

Iain Sandoe <iains at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-01-17
             Status|UNCONFIRMED                 |NEW
           Assignee|unassigned at gcc dot gnu.org      |iains at gcc dot gnu.org
                 CC|                            |iains at gcc dot gnu.org

--- Comment #1 from Iain Sandoe <iains at gcc dot gnu.org> ---
this fail occurs because

 * gm2 builds its own command lines for the preprocessor (the way it works at
present, [preprocssing the main fil and all its dependent .def and .mod] means
that we cannot construct a suitable line from the driver.

 * the command line options needed to enable the correct target state in the
built preprocessor lines are not being captured from the initial command line.

I have a WIP in patch to rework the options capture and handling of stand-alone
preprocessor jobs ( e.g. gm2 -E ... )

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

* [Bug modula2/102343] gm2/cpp/pass/subaddr.mod FAILs for non-default multilib
  2021-09-15 11:15 [Bug modula2/102343] New: gm2/cpp/pass/subaddr.mod FAILs for non-default multilib ro at gcc dot gnu.org
  2023-01-17 15:18 ` [Bug modula2/102343] " iains at gcc dot gnu.org
@ 2023-01-17 16:52 ` iains at gcc dot gnu.org
  2023-01-22  0:22 ` iains at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: iains at gcc dot gnu.org @ 2023-01-17 16:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Iain Sandoe <iains at gcc dot gnu.org> ---
Created attachment 54289
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54289&action=edit
Patch for discussion

This applies on top of the patch for PR108182 (and will most likely not work
without those changes).

 * -save-temps* should be fixed
 * we no longer try to write those files into the install directories
 * we should now support " gm2 -E .... "
 * renamed the pre-processed file extension to ".m2i" we cannot use ".i" or GCC
will try to process it with cc1.
 * We now have default handers for .mod and .m2i (maybe we should add .def is
that something used stand-alone?) So trying to use them with a compiler without
modula-2 should give a more sensible diagnostic.
 * we should handle " gm2 foo.mod.m2i "
 * last, but most important, we now collect the command line options needed to
set the target state into the preprocessor command line.  This then provides
the correct pre-defines and the test case then does the right thing on a 32b
multilib on a 64b host.

If there are no comments in the next week or so I'll post this to the list.

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

* [Bug modula2/102343] gm2/cpp/pass/subaddr.mod FAILs for non-default multilib
  2021-09-15 11:15 [Bug modula2/102343] New: gm2/cpp/pass/subaddr.mod FAILs for non-default multilib ro at gcc dot gnu.org
  2023-01-17 15:18 ` [Bug modula2/102343] " iains at gcc dot gnu.org
  2023-01-17 16:52 ` iains at gcc dot gnu.org
@ 2023-01-22  0:22 ` iains at gcc dot gnu.org
  2023-01-25 15:24 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: iains at gcc dot gnu.org @ 2023-01-22  0:22 UTC (permalink / raw)
  To: gcc-bugs

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

Iain Sandoe <iains at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #54289|0                           |1
        is obsolete|                            |

--- Comment #3 from Iain Sandoe <iains at gcc dot gnu.org> ---
Created attachment 54326
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54326&action=edit
Patch to be posted

this patch is candidate for posting - see changelog entry.

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

* [Bug modula2/102343] gm2/cpp/pass/subaddr.mod FAILs for non-default multilib
  2021-09-15 11:15 [Bug modula2/102343] New: gm2/cpp/pass/subaddr.mod FAILs for non-default multilib ro at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-01-22  0:22 ` iains at gcc dot gnu.org
@ 2023-01-25 15:24 ` cvs-commit at gcc dot gnu.org
  2023-01-25 15:45 ` iains at gcc dot gnu.org
  2023-01-27  8:48 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-01-25 15:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Iain D Sandoe <iains@gcc.gnu.org>:

https://gcc.gnu.org/g:80cf2c5e8f496bed9c6facf55f9ae31d0d90fd28

commit r13-5373-g80cf2c5e8f496bed9c6facf55f9ae31d0d90fd28
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Mon Jan 16 14:07:20 2023 +0000

    modula-2: Fixes for preprocessing [PR102343, PR108182].

    Modula-2 uses the C preprocessor to implement handling for conditional
    code and macros.  However, this is not done directly, because the process
    is applied recursively to imported definitions and modules.

    The cc1gm2 executable records the parameters as a template command line
    needed to create a composite 'cc1 -E' for each file to be preprocessed
    starting with the main file from the original command line.

    This patch fixes the capture of the C preprocessor template to include
    the target information needed for correct multilib operation.

    In order to match the existing semantics of '-E, -M and -MM' these have
    to be handled as a 'pre-processor only' job (i.e. the recursion is omitted
    and only the main file is processed).

    Whereas C-family front ends always pre-process, Modula-2 only does so
    when specifically requested (via the -fcpp option).

    '-MD, -MMD and -MQ' also require special handling, since (in principle)
    these options can be applied to any command line (with -fcpp) providing
    dependency information as a by-product.

    TODO: the preprocessor is not able to determine def and mod dependencies
    for Modula-2 and so the output of this only shows the object to module
    dep.  We should be able to append the .def and .mod dependencies.

    The patch amends save-temps handling to cater for the preprocessor
    recursion and to avoid writing saved files into the source directories.

    The patch changes the extension for Modula-2 preprocessed source to .m2i
    to avoid clashes with .i.

    The main driver code is amended to add default handlers for .mod and .m2i
    so that a useful error message will be emitted if the Modula-2 compiler
    is not built-in.

    The compiler will now also handle code generation from a .m2i preprocessed
    source.

    TODO: We should not need to pass the '-c' option to the compiler to alter
    the processing of init code.

    Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

            PR modula2/102343
            PR modula2/108182

    gcc/ChangeLog:

            * gcc.cc: Provide default specs for Modula-2 so that when the
            language is not built-in better diagnostics are emitted for
            attempts to use .mod or .m2i file extensions.

    gcc/m2/ChangeLog:

            * gm2-compiler/M2Comp.mod: Early exit for pre-processor-only jobs.
            * gm2-compiler/M2Options.def (SetPPOnly, GetPPOnly, SetMD, GetMD,
            SetMMD, GetMMD, SetMQ, GetMQ, SetObj, GetObj, SetDumpDir,
            GetDumpDir):New.
            * gm2-compiler/M2Options.mod:(SetPPOnly, GetPPOnly, SetMD, GetMD,
            SetMMD, GetMMD, SetMQ, GetMQ, SetObj, GetObj, SetDumpDir,
            GetDumpDir):New.
            * gm2-compiler/M2Preprocess.def (PreprocessModule): Add flag to
            indicate the main file.
            * gm2-compiler/M2Preprocess.mod: Handle Preprocess-only jobs,
            handle MD, MMD and MQ options.
            * gm2-gcc/m2options.h (M2Options_SetPPOnly, M2Options_GetPPOnly,
            M2Options_SetDumpDir, M2Options_SetMD, M2Options_GetMD,
            M2Options_SetMMD, M2Options_GetMMD, M2Options_SetMQ,
M2Options_GetMQ,
            M2Options_SetObj, M2Options_GetObj): New.
            * gm2-gcc/m2type.cc (m2type_InitBaseTypes): Early exit for pre-
            processor-only jobs.
            * gm2-lang.cc (gm2_langhook_init): Handle preprocess-only commands.
            (gm2_langhook_option_lang_mask): Claim C and Driver options so that
            we can intercept them for building pre-processor commands.
            (gm2_langhook_init_options): Collect the preprocessor line here.
            Save options that have different actions for preprocessor and
compile
            commands.
            (gm2_langhook_handle_option): Only handle the modula-2 options
here.
            (gm2_langhook_post_options): Do not create a back-end for pre-
            processor-only jobs.
            * gm2spec.cc (lang_specific_driver): Ignore PCH options, append a
            scaffold-main for cases where we are building a main module with
            -c.
            * lang-specs.h: Revise to handle preprocessor-only jobs and to
            consume pre-processed files.
            * lang.opt: Remove Driver and C options copies (we claim these
            separately).

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

* [Bug modula2/102343] gm2/cpp/pass/subaddr.mod FAILs for non-default multilib
  2021-09-15 11:15 [Bug modula2/102343] New: gm2/cpp/pass/subaddr.mod FAILs for non-default multilib ro at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-01-25 15:24 ` cvs-commit at gcc dot gnu.org
@ 2023-01-25 15:45 ` iains at gcc dot gnu.org
  2023-01-27  8:48 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: iains at gcc dot gnu.org @ 2023-01-25 15:45 UTC (permalink / raw)
  To: gcc-bugs

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

Iain Sandoe <iains at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #5 from Iain Sandoe <iains at gcc dot gnu.org> ---
so fixed on trunk

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

* [Bug modula2/102343] gm2/cpp/pass/subaddr.mod FAILs for non-default multilib
  2021-09-15 11:15 [Bug modula2/102343] New: gm2/cpp/pass/subaddr.mod FAILs for non-default multilib ro at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2023-01-25 15:45 ` iains at gcc dot gnu.org
@ 2023-01-27  8:48 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-01-27  8:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Iain D Sandoe <iains@gcc.gnu.org>:

https://gcc.gnu.org/g:83979240c072599bc8595a9324c3f4371eedbc7c

commit r13-5426-g83979240c072599bc8595a9324c3f4371eedbc7c
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Thu Jan 26 13:49:11 2023 +0000

    Modula-2: Add claimed command line options to lang.opt [PR108555].

    This is a partial reversion of the changes in r13-5373-g80cf2c5e8f496b.

    As observed in the PR, handling the C and Driver options in the Modula-2
    lang-specific code could be difficult to emulate; This reverts to adding
    the required options to the language-specific .opt file.

    Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

            PR modula2/108555
            PR modula2/108182
            PR modula2/102343

    gcc/m2/ChangeLog:

            * gm2-lang.cc (gm2_langhook_option_lang_mask): Do not claim CL_C
            or CL_DRIVER.
            (gm2_langhook_init_options): Handle options that we want to pass
            to the preprocessor.
            * lang-specs.h: Pass -B and -save-temps to regular compile lines.
            * lang.opt: Add C and Driver options that Modula-2 intercepts for
            internal use. Reorder options into two sections and to collate.

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

end of thread, other threads:[~2023-01-27  8:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-15 11:15 [Bug modula2/102343] New: gm2/cpp/pass/subaddr.mod FAILs for non-default multilib ro at gcc dot gnu.org
2023-01-17 15:18 ` [Bug modula2/102343] " iains at gcc dot gnu.org
2023-01-17 16:52 ` iains at gcc dot gnu.org
2023-01-22  0:22 ` iains at gcc dot gnu.org
2023-01-25 15:24 ` cvs-commit at gcc dot gnu.org
2023-01-25 15:45 ` iains at gcc dot gnu.org
2023-01-27  8:48 ` cvs-commit at gcc dot gnu.org

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).