public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "arkadiusz at drabczyk dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/67925] docs lie about being unable to inline function call before definition Date: Mon, 12 Oct 2015 19:32:00 -0000 [thread overview] Message-ID: <bug-67925-4-bCPmIMZnZ9@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-67925-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67925 --- Comment #6 from Arkadiusz Drabczyk <arkadiusz at drabczyk dot org> --- Sorry, this code is wrong of course, value returned by factorial() must be used to generate an actual code: $ cat bug1.c #include <stdio.h> #include <stdlib.h> inline static int factorial(unsigned int i) { if(i <= 1) { return 1; } return i * factorial(i - 1); } int main(void) { printf("%d\n", factorial(12)); exit(0); } $ cat bug1.s .file "bug1.c" .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "%d\n" .section .text.startup,"ax",@progbits .p2align 4,,15 .globl main .type main, @function main: .LFB22: .cfi_startproc subq $8, %rsp .cfi_def_cfa_offset 16 movl $1, %esi movl $12, %eax .p2align 4,,10 .p2align 3 .L2: imull %eax, %esi subl $1, %eax cmpl $1, %eax jne .L2 movl $.LC0, %edi xorl %eax, %eax call printf xorl %edi, %edi call exit .cfi_endproc .LFE22: .size main, .-main .ident "GCC: (GNU) 6.0.0 20151004 (experimental)" .section .note.GNU-stack,"",@progbits
next prev parent reply other threads:[~2015-10-12 19:32 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-10-11 19:59 [Bug c/67925] New: " arkadiusz at drabczyk dot org 2015-10-11 20:08 ` [Bug c/67925] " arkadiusz at drabczyk dot org 2015-10-11 20:30 ` miyuki at gcc dot gnu.org 2015-10-12 8:08 ` rguenth at gcc dot gnu.org 2015-10-12 19:20 ` arkadiusz at drabczyk dot org 2015-10-12 19:20 ` arkadiusz at drabczyk dot org 2015-10-12 19:32 ` arkadiusz at drabczyk dot org [this message] 2015-10-13 15:11 ` arkadiusz at drabczyk dot org 2015-10-13 15:12 ` arkadiusz at drabczyk dot org 2015-10-13 18:18 ` segher at gcc dot gnu.org 2015-10-13 22:52 ` arkadiusz at drabczyk dot org 2015-10-20 5:53 ` law at redhat dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-67925-4-bCPmIMZnZ9@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).