Error Floating Point Constant Invalid For Type
Contents |
från GoogleLogga inDolda fältSök efter grupper eller meddelanden
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Is it possible to https://groups.google.com/d/topic/llvm-dev/s97whlBkV5Y specify a hexademical number in LLVM IR code? up vote 2 down vote favorite For example: error: floating point constant invalid for type %3 = and i8 0x80, %2 ^ llvm llvm-ir share|improve this question asked Apr 30 '13 at 23:22 andrewrk 10.1k186487 add a comment| 1 Answer 1 active oldest votes up vote 2 down vote accepted From a scan of the IR reference http://stackoverflow.com/questions/16310509/is-it-possible-to-specify-a-hexademical-number-in-llvm-ir-code manual, it looks like hexadecimal literals are reserved for the representation of floating point numbers that cannot be exactly represented in a reasonable number of digits. Which explains why your error message says that the floating point constant is invalid. share|improve this answer answered May 1 '13 at 1:42 Aatch 1,644718 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name Email discard By posting your answer, you agree to the privacy policy and terms of service. Not the answer you're looking for? Browse other questions tagged llvm llvm-ir or ask your own question. asked 3 years ago viewed 165 times active 3 years ago Linked 0 have llvm::Module::dump print integers in hex Related 4How to Insert a LLVM Instruction?0Vector Addition Program in LLVM-1LLVM converting a Constant to a Value0LLVM IR instruction insertion0LLVM IR and floating point numbers0What is the advantage of LLVM Builder over manual construction of IR code?1Representing void pointer type in llvm ir8LLVM struct array iteration4LLVM IR types being collap
Sign in Pricing Blog Support https://github.com/tpoechtrager/llvm-dsymutil/blob/master/test/CodeGen/MIR/NVPTX/floating-point-invalid-type-error.mir Search GitHub This repository Watch 3 Star 3 Fork 875 tpoechtrager/llvm-dsymutil forked from llvm-mirror/llvm Code Pull requests 0 Projects https://sourceware.org/bugzilla/show_bug.cgi?id=20068 0 Pulse Graphs Permalink Branch: master Switch branches/tags Branches Tags master Nothing to show Nothing to show Find file Copy floating point path llvm-dsymutil/test/CodeGen/MIR/NVPTX/floating-point-invalid-type-error.mir Fetching contributors… Cannot retrieve contributors at this time Raw Blame History 25 lines (21 sloc) 540 Bytes # RUN: not llc -march=nvptx -mcpu=sm_20 -run-pass none -o /dev/null %s 2>&1 | FileCheck %s --- | define float @test(float %k) { invalid floating point entry: %0 = fadd float %k, 3.250000e+00 ret float %0 } ... --- name: test registers: - { id: 0, class: float32regs } - { id: 1, class: float32regs } body: | bb.0.entry: %0 = LD_f32_avar 0, 4, 1, 2, 32, $test_param_0 ; CHECK: [[@LINE+1]]:33: floating point constant does not have type 'float' %1 = FADD_rnf32ri %0, float 0xH3C00 StoreRetvalF32 %1, 0 Return ... Jump to Line Go Contact GitHub API Training Shop Blog About © 2016 GitHub, Inc. Terms Privacy Security Status Help You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
NewAccount | Log In [x] | Forgot Password Login: [x] Bug20068 - GAS complains about ‘Error: floating point number invalid‘ when producing a literal pool. Summary: GAS complains about ‘Error: floating point number invalid‘ when producing a l... Status: RESOLVED FIXED Alias: None Product: binutils Classification: Unclassified Component: gas (show other bugs) Version: 2.27 Importance: P2 normal Target Milestone: --- Assignee: Not yet assigned to anyone URL: Keywords: Depends on: Blocks: Reported: 2016-05-10 12:43 UTC by Chua Zheng Leong Modified: 2016-05-11 17:04 UTC (History) CC List: 2 users (show) clyon nickc See Also: Host: Target: Build: Last reconfirmed: Attachments Change the type of padding to O_constant (443 bytes, patch) 2016-05-10 12:43 UTC, Chua Zheng Leong Details | Diff View All Add an attachment (proposed patch, testcase, etc.) Note You need to log in before you can comment on or make changes to this bug. Description Chua Zheng Leong 2016-05-10 12:43:14 UTC Created attachment 9248 [details] Change the type of padding to O_constant Assembling the following ARM assembly will result in gas complaining: LDR R0, =0x12345678 FLDD D9, =0xfff000000fff .LTORG ‘Error: floating point number invalid‘ Adding an additional 4 bytes into the literal pool will cause GAS to assemble without any errors. LDR R0, =0x12345678 LDR R0, =0x87654321 FLDD D9, =0xfff000000fff .LTORG Debugging GAS reveals that the error is generated from emit_expr_with_reloc(), more specifically, it fails this test : if (op == O_big && exp->X_add_number <= 0) Digging further, this expression is generated due to alignment for a 8 byte long literal being added to the pool, more specifically in add_to_lit_pool(). If the pool is not 8 byte aligned and a 8 byte literal is added to the pool, a 4 byte pad will be generated with the following code. <...> else if (pool_size & 0x7) { <....> pool->literals[entry] = inst.reloc.exp; pool->literals[entry].X_add_number = 0; pool->literals[entry++].X_md = (PADDING_SLOT << 8) | 4; pool->next_free_entry += 1; pool_size += 4; } Since the current exp is of type O_big, the padding expression will be of type O_big with X_add_number = 0 failing the above test. Workaround patch: Change the type of the padding to O_constant. Again, not too sure about the correctness. Comment 1 Nick Clifton 2016-05-11 10:19:03 UTC Hi Chua, > Assembling the following ARM assembly will result in gas complaining: > LDR R0, =0x12345678 > FLDD D9, =0xfff000000fff > .LTORG > ‘Error: floating point number invalid‘ What c