This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug rtl-optimization/66626] [4.9/5/6 Regression] gcc.dg/torture/stackalign/non-local-goto-5.c segfaults w/ -mregparm=3


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

--- Comment #6 from H.J. Lu <hjl.tools at gmail dot com> ---
ix86_function_regparm has

             /* We don't want to use regparm(3) for nested functions as
                 these use a static chain pointer in the third argument.  */
              if (local_regparm == 3 && DECL_STATIC_CHAIN (target->decl))
                local_regparm = 2;

              /* Save a register for the split stack.  */
              if (local_regparm == 3 && flag_split_stack)
                local_regparm = 2;

              /* Each fixed register usage increases register pressure,
                 so less registers should be used for argument passing.
                 This functionality can be overriden by an explicit
                 regparm value.  */
              for (regno = AX_REG; regno <= DI_REG; regno++)
                if (fixed_regs[regno])
                  globals++;

              local_regparm
                = globals < local_regparm ? local_regparm - globals : 0;

              if (local_regparm > regparm)
                                ^^^ Shouldn't it be "<"?
                regparm = local_regparm;
            }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]