[Bug cobol/119883] codegen: recursive user-defined functions don't run recursive

2025-05-22 Thread simonsobisch at gnu dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119883

Simon Sobisch  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|NEW |RESOLVED

--- Comment #4 from Simon Sobisch  ---
It is correct now.
Old result:

Return value '0'


Current result, as expected:

Step: 1, Arg: 5, Return: 5
Step: 2, Arg: 4, Return: 5
Step: 3, Arg: 3, Return: 5
Step: 4, Arg: 2, Return: 5
Step: 5, Arg: 1, Return: 5
Return value '5'

[Bug cobol/119883] codegen: recursive user-defined functions don't run recursive

2025-05-20 Thread rdubner at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119883

--- Comment #3 from Robert Dubner  ---
(In reply to James K. Lowden from comment #2)
> The issue appears to boil down to YYLTYPE and YDFLTYPE, which are identical,
> being defined differently somehow, somewhere.  A clue perhaps: in
> gcc/cobol/util.cc, we have
> 
> void
> cbl_field_t::report_invalid_initial_value(const YYLTYPE& loc) const
> 
> which appears to be the source of the complaint about the "type itself" in
> warn_odr. 
> 
> In the util.o, there are 4 definitions: 
> 
> 25d0 T cbl_field_t::report_invalid_initial_value(YYLTYPE const&)
> const
> 2524 t cbl_field_t::report_invalid_initial_value(YYLTYPE const&)
> const::{lambda(char)#2}::operator()(char) const
> 2548 t cbl_field_t::report_invalid_initial_value(YYLTYPE const&)
> const::{lambda(char)#3}::operator()(char) const
> 24f0 t cbl_field_t::report_invalid_initial_value(YYLTYPE const&)
> const::{lambda(char)#1}::operator()(char) const
> 
> I don't know what 
> 
> const::{lambda(char)#1}::operator()(char) 
> 
> refers to.  
> 
> The sole call to this function is from parse.y:3755 
> 
> $field->report_invalid_initial_value(@data_clauses);

Jim, you put this comment into the wrong PR.

[Bug cobol/119883] codegen: recursive user-defined functions don't run recursive

2025-05-20 Thread jklowden at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119883

James K. Lowden  changed:

   What|Removed |Added

 Status|WAITING |NEW
   Assignee|rdubner at gcc dot gnu.org |jklowden at gcc dot 
gnu.org

--- Comment #2 from James K. Lowden  ---
The issue appears to boil down to YYLTYPE and YDFLTYPE, which are identical,
being defined differently somehow, somewhere.  A clue perhaps: in
gcc/cobol/util.cc, we have

void
cbl_field_t::report_invalid_initial_value(const YYLTYPE& loc) const

which appears to be the source of the complaint about the "type itself" in
warn_odr. 

In the util.o, there are 4 definitions: 

25d0 T cbl_field_t::report_invalid_initial_value(YYLTYPE const&)
const
2524 t cbl_field_t::report_invalid_initial_value(YYLTYPE const&)
const::{lambda(char)#2}::operator()(char) const
2548 t cbl_field_t::report_invalid_initial_value(YYLTYPE const&)
const::{lambda(char)#3}::operator()(char) const
24f0 t cbl_field_t::report_invalid_initial_value(YYLTYPE const&)
const::{lambda(char)#1}::operator()(char) const

I don't know what 

const::{lambda(char)#1}::operator()(char) 

refers to.  

The sole call to this function is from parse.y:3755 

$field->report_invalid_initial_value(@data_clauses);

[Bug cobol/119883] codegen: recursive user-defined functions don't run recursive

2025-05-20 Thread rdubner at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119883

Robert Dubner  changed:

   What|Removed |Added

 Status|NEW |WAITING

--- Comment #1 from Robert Dubner  ---
Simon, I don't understand why you think the function "foo" isn't running
recursively.

The GCC-16 version is behaving exactly as I would expect it to.  And I don't
believe it has changed since GCC-15.

What do you think it should be doing?

[Bug cobol/119883] codegen: recursive user-defined functions don't run recursive

2025-05-20 Thread jklowden at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119883

James K. Lowden  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever confirmed|0   |1
   Assignee|unassigned at gcc dot gnu.org  |rdubner at gcc dot 
gnu.org
 CC||jklowden at gcc dot gnu.org
   Last reconfirmed||2025-05-20