Operating System - HP-UX
1753674 Members
5331 Online
108799 Solutions
New Discussion юеВ

Re: Weird Error when compiled Proc code with +Ofast compiler option

 
K!rn Kumr
Frequent Advisor

Wierd Error when compiled Proc code with +Ofast compiler option

Hi

Today I have faced really a wierd error. I have a Pro C code which is first converted to c file and then I compiled it with aCC compiler using +Ofast compiler option. Then the code behaves in way different from when it is compiled without Ofast option. And later behaviour is the expected one.

I have debug statement immediately after the END-EXEC; statement in the file, which is the end of the pl/sql block. This debug statement is making the difference. It works fine if i remove the debug statement or remove Ofast from the compiler option or when i run the debug_binary.

Can anyone throw some lite on why this is happening??

Thanks in advance
25 REPLIES 25
OldSchool
Honored Contributor

Re: Wierd Error when compiled Proc code with +Ofast compiler option

1) "the code behaves in way different from when it is compiled without Ofast option"
2) "This debug statement is making the difference."
3) "It works fine if i remove the debug statement or remove Ofast from the compiler option or when i run the debug_binary"

Well...depending upon which of the above statements is really the case, then you have 4 (or possibly more) cases.

Knowing nothing of ProC, I think the first step would be to capture the .c files emitted by ProC to see what changes occur with and without the referenced debug statement.

Then compile both of them, once with and once without the -Ofast option and see which ones work as expected.
K!rn Kumr
Frequent Advisor

Re: Wierd Error when compiled Proc code with +Ofast compiler option

Yeah as you have said when I precompile the proc to get c file. Then I compile the c file with +ofast option and get the binary.

I have a code which i compile to get a shared library. In that I have a small function which I used in different there code peices by include/linking the correct headers/library. And the function I just logs the statments to a file when debug is on.

Here are my observations

1. When I have the debug statement and I have +Ofast option.

This case does not work fine.

2. When I have the debug statement and I do not use +Ofast option.

This case is good.

And I have tried to look into the c file in both the cases it is the same.

3. With Ofast option if I remove the debug statement the result is good.

Steven Schweda
Honored Contributor

Re: Wierd Error when compiled Proc code with +Ofast compiler option

Here are my observations:

1. I can't see any of the code.

2. I don't have a program that I can test.

3. My psychic powers are very weak.
Dennis Handly
Acclaimed Contributor

Re: Weird Error when compiled Proc code with +Ofast compiler option

What OS are you using? What aC++ version are you using? The latest aCC6 version is A.06.23.
(Previous threads had 11.23 and A.06.15.)

Have you removed +Ofast and replaced by +O2?

K!rn Kumr
Frequent Advisor

Re: Wierd Error when compiled Proc code with +Ofast compiler option

My compiler version is
HP C/aC++ Version A.06.20

My OS is
B.11.23 U ia64

Attached is the code. And the last line is the one which creates the problem.
K!rn Kumr
Frequent Advisor

Re: Wierd Error when compiled Proc code with +Ofast compiler option

When I replace +Ofast with anything it works fine.
Dennis Handly
Acclaimed Contributor

Re: Weird Error when compiled Proc code with +Ofast compiler option

>HP C/aC++ Version A.06.20

You should install the latest patch, PHSS_39823.

>Attached is the code.

That is useless, I would need a .i. And unless you could run it, that wouldn't be that helpful.

K!rn Kumr
Frequent Advisor

Re: Wierd Error when compiled Proc code with +Ofast compiler option

I have observed one more thing. Though in my Pro C code I have not declared any cursors. In the c file I have a macro define for cursor.

#ifndef SQL_CRSR
# define SQL_CRSR
struct sql_cursor
{
unsigned int curocn;
void *ptr1;
void *ptr2;
unsigned int magic;
};
typedef struct sql_cursor sql_cursor;
typedef struct sql_cursor SQL_CURSOR;
#endif /* SQL_CRSR */

This code is generated by the proc compiler.

When I compile the above code with ofasat option my result is invalid cursor

And when I compile it without ofast option I get the data.
Dennis Handly
Acclaimed Contributor

Re: Weird Error when compiled Proc code with +Ofast compiler option

>result is invalid cursor

You could print out struct sql_cursor in gdb and compare the good and bad.