[LLVMbugs] [Bug 9559] New: post-increment in formal argument list ignored

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Mar 25 14:20:55 PDT 2011


http://llvm.org/bugs/show_bug.cgi?id=9559

           Summary: post-increment in formal argument list ignored
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: ahatanak at gmail.com
                CC: llvmbugs at cs.uiuc.edu


In the following example, main returns with exit code 1 because function sub
returns i instead of i+1.

# .c file
sub (int i, int array[i++])
{
  return i;
}

main()
{
  int array[10];
  exit (sub (10, array) != 11);
}

# .ll file.                             
# clang tests-c/970217-1.c -emit-llvm -O3 -S -o -
; ModuleID = 'tests-c/970217-1.c'
target datalayout =
"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32"
target triple = "i386-pc-linux-gnu"

define i32 @sub(i32 %i, i32* nocapture %array) nounwind readnone {
entry:
  ret i32 %i
}

define i32 @main() noreturn nounwind {
entry:
  tail call void @exit(i32 1) noreturn nounwind
  unreachable
}

declare void @exit(i32) noreturn

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list